pinctrl: rockchip: use *enum* properly in rockchip_pinconf_pull_valid()
Subsystems (3)
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
@@ -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
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 withPIN_CONFIG_BIAS_BUS_HOLDinstead, dropping the unnecessary ?: operator as well...Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
Signed-off-by Sergey Shtylyov <[email protected]>
[...]
Forgot to add that the patch wass against the for-next branch of Linus W.'s
linux-pinctrl.git repo.
MBR, Sergey