Commit 3df71bb7 authored by Neill Kapron's avatar Neill Kapron Committed by Greg Kroah-Hartman
Browse files

phy: rockchip-typec: fix tcphy_get_mode error case



[ Upstream commit 4ca651df ]

The existing logic in tcphy_get_mode() can cause the phy to be
incorrectly configured to USB UFP or DisplayPort mode when
extcon_get_state returns an error code.

extcon_get_state() can return 0, 1, or a negative error code.

It is possible to get into the failing state with an extcon driver
which does not support the extcon connector id specified as the
second argument to extcon_get_state().

tcphy_get_mode()
->extcon_get_state()
-->find_cable_index_by_id()
--->return -EINVAL;

Fixes: e96be45c ("phy: Add USB Type-C PHY driver for rk3399")
Signed-off-by: default avatarNeill Kapron <nkapron@google.com>
Reviewed-by: default avatarLee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230126001013.3707873-1-nkapron@google.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 295ab6d4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment