Skip to contentSkip to conversation

pinctrl: rockchip: use *enum* properly in rockchip_pinconf_pull_valid()

PATCH In review Sergey Shtylyov 1 participant 2 messages Feb 23

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: rockchip: use *enum* properly in rockchip_pinconf_pull_valid()

In rockchip_pinconf_pull_valid(), the pull parameter has *enum* type that is not isomorphic with boolean type but it's used as a boolean expression in the ?: operator. Compare pull with PIN_CONFIG_BIAS_BUS_HOLD instead, dropping the unnecessary ?: operator as well...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

---
 drivers/pinctrl/pinctrl-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-rockchip.c +1 -1
index 816823403e97..6d0ba2a258d1 100644
@@ -3577,7 +3577,7 @@ static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl *ctrl,
 		return (pull == PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ||
 					pull == PIN_CONFIG_BIAS_DISABLE);
 	case RK3066B:
-		return pull ? false : true;
+		return pull == PIN_CONFIG_BIAS_BUS_HOLD;
 	case PX30:
 	case RV1108:
 	case RV1126:
Signature · 1 line
2.53.0
#1 lore raw
Quoted 9 lines · Sergey Shtylyov

In rockchip_pinconf_pull_valid(), the pull parameter has *enum* type that is not isomorphic with boolean type but it's used as a boolean expression in the ?: operator. Compare pull with PIN_CONFIG_BIAS_BUS_HOLD instead, dropping the unnecessary ?: operator as well...

Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.

[...]

Forgot to add that the patch wass against the for-next branch of Linus W.'s
linux-pinctrl.git repo.

MBR, Sergey