public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea della Porta <andrea.porta@suse.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Andrea della Porta <andrea.porta@suse.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] pinctrl: rp1: silence uninitialized variable warning
Date: Tue, 1 Jul 2025 11:30:01 +0200	[thread overview]
Message-ID: <aGOqmd5cvCeBjWMI@apocalypse> (raw)
In-Reply-To: <748d256a-dc9d-4f85-aaa4-d480b7c4fd22@sabinyo.mountain>

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
> 

  reply	other threads:[~2025-07-01  9:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 19:35 [PATCH] pinctrl: rp1: silence uninitialized variable warning Dan Carpenter
2025-07-01  9:30 ` Andrea della Porta [this message]
2025-07-01 19:04   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aGOqmd5cvCeBjWMI@apocalypse \
    --to=andrea.porta@suse.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox