Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: linux-gpio@vger.kernel.org
Subject: Re: [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors
Date: Fri, 09 Oct 2026 11:34:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-165390@kernel.org> (raw)
In-Reply-To: <20261009112634.33436-1-phucduc.bui@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pinctrl: uninitialized variable ret used in dev_err_probe() on error path
--

commit 102caea02ef327a69988ba143522defe7312fabf
Author: bui duc phuc <phucduc.bui@gmail.com>

pinctrl: mcp23s08: Propagate reset GPIO errors

This commit updates mcp23s08_probe_one() to catch and propagate errors
encountered when requesting the reset GPIO. It adds an error check to avoid
silently ignoring issues like deferred probing.

> diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
> index cc668f84bf8bc..fab6d19a559e3 100644
> --- a/drivers/pinctrl/pinctrl-mcp23s08.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08.c
> @@ -613,6 +613,8 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
>  	mcp->chip.owner = THIS_MODULE;
>  
>  	mcp->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> +	if (IS_ERR(mcp->reset_gpio))
> +		return dev_err_probe(dev, ret, "failed to get reset GPIO\n");

[Severity: High]
Is ret uninitialized when used here? Looking at mcp23s08_probe_one() in
drivers/pinctrl/pinctrl-mcp23s08.c, ret is declared at the top of the
function but does not appear to be assigned a value before this point.

If devm_gpiod_get_optional() fails, will this return a garbage value
from the stack instead of the actual error code? Would passing
PTR_ERR(mcp->reset_gpio) to dev_err_probe() instead of ret correctly
propagate the error?

>  
>  	/* verify MCP_IOCON.SEQOP = 0, so sequential reads work,
>  	 * and MCP_IOCON.HAEN = 1, so we work with all chips.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009112634.33436-1-phucduc.bui@gmail.com?part=1

  reply	other threads:[~2026-10-09 11:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 11:26 [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors phucduc.bui
2026-10-09 11:34 ` sashiko-bot [this message]
2026-10-10  3:23   ` Bui Duc Phuc
2026-10-10  1:25 ` kernel test robot
2026-10-10  3:26   ` Bui Duc Phuc

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=sashiko-outbox-165390@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=phucduc.bui@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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