2023-02-13 03:57:35

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH v2] phy: rockchip-typec: Fix unsigned comparison with less than zero

The dp and ufp are defined as bool type, the return value type of
function extcon_get_state should be int, so the type of dp and ufp
are modified to int.

./drivers/phy/rockchip/phy-rockchip-typec.c:827:12-14: WARNING: Unsigned expression compared with zero: dp > 0.

Reported-by: Abaci Robot <[email protected]>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3962
Signed-off-by: Jiapeng Chong <[email protected]>
---
Changes in v2:
-Add ufp modification.

drivers/phy/rockchip/phy-rockchip-typec.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 6aea512e5d4e..39db8acde61a 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -808,9 +808,8 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
struct extcon_dev *edev = tcphy->extcon;
union extcon_property_value property;
unsigned int id;
- bool ufp, dp;
u8 mode;
- int ret;
+ int ret, ufp, dp;

if (!edev)
return MODE_DFP_USB;
--
2.20.1.7.g153144c



2023-02-14 13:59:12

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH v2] phy: rockchip-typec: Fix unsigned comparison with less than zero

On 13-02-23, 11:57, Jiapeng Chong wrote:
> The dp and ufp are defined as bool type, the return value type of
> function extcon_get_state should be int, so the type of dp and ufp
> are modified to int.
>

Applied, thanks

--
~Vinod