drivers/pinctrl/pinctrl-rp1.c | 2 ++ 1 file changed, 2 insertions(+)
This default path could probably can't be reached but Smatch can't
verify it so it complains that "arg" isn't initialized on this path.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
I didn't add a Fixes tag because this likely isn't a real bug. Plus this
code is very new so it doesn't need to be backported anyway.
Also checkpatch complains:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
But I left it that way so it's consistent with the other return in
the function. Maybe we should change both?
drivers/pinctrl/pinctrl-rp1.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-rp1.c b/drivers/pinctrl/pinctrl-rp1.c
index d300f28c52cd..f9cc6b28994c 100644
--- a/drivers/pinctrl/pinctrl-rp1.c
+++ b/drivers/pinctrl/pinctrl-rp1.c
@@ -1524,6 +1524,8 @@ static int rp1_pinconf_get(struct pinctrl_dev *pctldev, unsigned int offset,
case RP1_PAD_DRIVE_12MA:
arg = 12;
break;
+ default:
+ return -ENOTSUPP;
}
break;
case PIN_CONFIG_BIAS_DISABLE:
--
2.47.2
Hi Dan, On 14:35 Mon 30 Jun , Dan Carpenter wrote: > This default path could probably can't be reached but Smatch can't > verify it so it complains that "arg" isn't initialized on this path. > > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Thanks for your patch! > --- > I didn't add a Fixes tag because this likely isn't a real bug. Plus this > code is very new so it doesn't need to be backported anyway. > > Also checkpatch complains: > > WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP > > But I left it that way so it's consistent with the other return in > the function. Maybe we should change both? We really can't get rid of that warning by replacing ENOTSUPP with EOPNOTSUPP because the core pinctrl code still rely on the 'wrong' define, like this excerpt from drivers/pinctrl/pinconf-generic.c: ... if (gname) ret = pin_config_group_get(dev_name(pctldev->dev), gname, &config); else ret = pin_config_get_for_pin(pctldev, pin, &config); /* These are legal errors */ if (ret == -EINVAL || ret == -ENOTSUPP) continue; ... Also, many drivers still rely on ENOTSUPP. Maybe a patch that will fix all of them at once (drivers and core code) is in order, I have it in my todo list, indeed. Besides that, Reviewed-by: Andrea della Porta <andrea.porta@suse.com> Many thanks, Andrea > > drivers/pinctrl/pinctrl-rp1.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/pinctrl/pinctrl-rp1.c b/drivers/pinctrl/pinctrl-rp1.c > index d300f28c52cd..f9cc6b28994c 100644 > --- a/drivers/pinctrl/pinctrl-rp1.c > +++ b/drivers/pinctrl/pinctrl-rp1.c > @@ -1524,6 +1524,8 @@ static int rp1_pinconf_get(struct pinctrl_dev *pctldev, unsigned int offset, > case RP1_PAD_DRIVE_12MA: > arg = 12; > break; > + default: > + return -ENOTSUPP; > } > break; > case PIN_CONFIG_BIAS_DISABLE: > -- > 2.47.2 >
On Tue, Jul 01, 2025 at 11:30:01AM +0200, Andrea della Porta wrote: > We really can't get rid of that warning by replacing ENOTSUPP with > EOPNOTSUPP because the core pinctrl code still rely on the 'wrong' > define Ah good. Thanks for the explanation. I'm glad I didn't try "fix" it then. :) > like this excerpt from drivers/pinctrl/pinconf-generic.c: > > ... > if (gname) > ret = pin_config_group_get(dev_name(pctldev->dev), > gname, &config); > else > ret = pin_config_get_for_pin(pctldev, pin, &config); > /* These are legal errors */ > if (ret == -EINVAL || ret == -ENOTSUPP) > continue; > ... > > Also, many drivers still rely on ENOTSUPP. Maybe a patch that will > fix all of them at once (drivers and core code) is in order, I have > it in my todo list, indeed. > Besides that, > > Reviewed-by: Andrea della Porta <andrea.porta@suse.com> Thanks! regards, dan carpenter
© 2016 - 2025 Red Hat, Inc.