pinctrl: airoha: fix bias readback in airoha_pinconf_get()
Subsystems (4)
PATCH 1/1 pinctrl: airoha: fix bias readback in airoha_pinconf_get()
In airoha_pinconf_get(), the last branch of bias check "else if (pull_up || pull_down)", has no check on the requested parameter. It was meant to reject PIN_CONFIG_BIAS_DISABLE when a pull is enabled, but it also runs for PIN_CONFIG_BIAS_PULL_UP and PIN_CONFIG_BIAS_PULL_DOWN. When the pin really has that pull set, the earlier PULL_UP/PULL_DOWN checks do not reject it, so the execution reaches this branch, which returns -EINVAL. Reading back a pull-up or pull-down therefore always fails.
--- drivers/pinctrl/airoha/pinctrl-airoha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/airoha/pinctrl-airoha.c +1 -1
@@ -554,7 +554,7 @@ static int airoha_pinconf_get(struct pinctrl_dev *pctrl_dev,else if (param ==PIN_CONFIG_BIAS_PULL_DOWN && !(pull_down && !pull_up))return -EINVAL ; -else if (pull_up || pull_down) +else if (param ==PIN_CONFIG_BIAS_DISABLE && (pull_up || pull_down))return -EINVAL ; arg =1 ;
Signature · 1 line
2.34.1
Linus Walleij
maintainerQuoted 10 lines · Vikrant Yadav
In
airoha_pinconf_get(), the last branch of bias check "else if (pull_up||pull_down)", has no check on the requested parameter. It was meant to rejectPIN_CONFIG_BIAS_DISABLEwhen a pull is enabled, but it also runs forPIN_CONFIG_BIAS_PULL_UPandPIN_CONFIG_BIAS_PULL_DOWN. When the pin really has that pull set, the earlier PULL_UP/PULL_DOWN checks do not reject it, so the execution reaches this branch, which returns-EINVAL. Reading back a pull-up or pull-down therefore always fails.Signed-off-by Vikrant Yadav <[email protected]>
Maybe Christian can ACK this patch if it looks right?
Yours,
Linus Walleij
Quoted 13 lines · Linus Walleij
Quoted 9 lines · Vikrant Yadav
In
airoha_pinconf_get(), the last branch of bias check "else if (pull_up||pull_down)", has no check on the requested parameter. It was meant to rejectPIN_CONFIG_BIAS_DISABLEwhen a pull is enabled, but it also runs forPIN_CONFIG_BIAS_PULL_UPandPIN_CONFIG_BIAS_PULL_DOWN. When the pin really has that pull set, the earlier PULL_UP/PULL_DOWN checks do not reject it, so the execution reaches this branch, which returns-EINVAL. Reading back a pull-up or pull-down therefore always fails.
Quoted 6 lines
Quoted 1 line
Signed-off-by Vikrant Yadav <[email protected]>Maybe Christian can ACK this patch if it looks right?
Yours,
Linus Walleij
Hi Christian,
Just checking if you got a chance to look at this patch. If you want any changes, I can send a v2.
Thanks,
Vikrant