From: Nathan Chancellor <nathan@kernel.org>
To: trix@redhat.com
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, ndesaulniers@google.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] gpio: sim: fix uninitialized ret variable
Date: Sat, 18 Dec 2021 14:59:48 -0700 [thread overview]
Message-ID: <Yb5Z1A1tX6xdrDce@archlinux-ax161> (raw)
In-Reply-To: <20211218152712.2832502-1-trix@redhat.com>
On Sat, Dec 18, 2021 at 07:27:12AM -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Building with clang returns this error:
>
> gpio-sim.c:889:7: error: variable 'ret' is uninitialized
> when used here
>
> ret should be the status of the call to
> gpio_sim_make_bank_swnode stored in bank->swnode.
>
> Fixes: 83960fcf4818 ("gpio: sim: new testing module")
> Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/gpio/gpio-sim.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index ef6145f51c8ae..bef00dcc4dc8f 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -886,7 +886,8 @@ static int gpio_sim_device_activate_unlocked(struct gpio_sim_device *dev)
>
> list_for_each_entry(bank, &dev->bank_list, siblings) {
> bank->swnode = gpio_sim_make_bank_swnode(bank, swnode);
> - if (ret) {
> + if (IS_ERR(bank->swnode)) {
> + ret = PTR_ERR(bank->swnode);
> gpio_sim_remove_swnode_recursive(swnode);
> return ret;
> }
> --
> 2.26.3
>
next prev parent reply other threads:[~2021-12-18 21:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-18 15:27 [PATCH] gpio: sim: fix uninitialized ret variable trix
2021-12-18 21:59 ` Nathan Chancellor [this message]
2021-12-19 13:48 ` Bartosz Golaszewski
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=Yb5Z1A1tX6xdrDce@archlinux-ax161 \
--to=nathan@kernel.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=trix@redhat.com \
/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