提交 3fbf9ea3 编写于 作者: P Prashant Malani 提交者: Zheng Zengkai

platform/chrome: cros_ec_typec: Add DP mode check

stable inclusion
from stable-5.10.39
commit 6a40e3f9a803d958ea497bc8522b33597b763b5c
bugzilla: 51881
CVE: NA

--------------------------------

[ Upstream commit c5bb32f5 ]

There are certain transitional situations where the dp_mode field in the
PD_CONTROL response might not be populated with the right DP pin
assignment value yet. Add a check for that to avoid sending an invalid
value to the Type C mode switch.
Signed-off-by: NPrashant Malani <pmalani@chromium.org>
Signed-off-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20210421042108.2002-1-pmalani@chromium.orgSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e7997b86
...@@ -475,6 +475,11 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec, ...@@ -475,6 +475,11 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
return -ENOTSUPP; return -ENOTSUPP;
} }
if (!pd_ctrl->dp_mode) {
dev_err(typec->dev, "No valid DP mode provided.\n");
return -EINVAL;
}
/* Status VDO. */ /* Status VDO. */
dp_data.status = DP_STATUS_ENABLED; dp_data.status = DP_STATUS_ENABLED;
if (port->mux_flags & USB_PD_MUX_HPD_IRQ) if (port->mux_flags & USB_PD_MUX_HPD_IRQ)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册