[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfLK=SQm7k=Gfj5pvgV9ncjuJkz2A6hJ4YqE6YDEdyyOQ@mail.gmail.com>
Date: Tue, 28 Jul 2020 21:27:27 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: trix@...hat.com
Cc: Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
frank.rowand@...y.com,
Geert Uytterhoeven <geert+renesas@...der.be>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: of: reset name variable in of_gpiochip_add_hog
On Tue, Jul 28, 2020 at 4:44 PM <trix@...hat.com> wrote:
>
> From: Tom Rix <trix@...hat.com>
>
> Clang static analysis reports this error
>
> gpiolib-of.c:664:9: warning: 2nd function call argument
> is an uninitialized value [core.CallAndMessage]
> ret = gpiod_hog(desc, name, lflags, dflags);
>
> name is sometimes set by of_parse_own_gpio
> name is always used by gpiod_hog
It's not clear if it's the output of the analyser.
If so, try to file a bug and fix there how it prints out functions,
should be func().
Otherwise fix in the commit message.
> So it is necessary to reset name so an old value is
the name
> not mistakenly used by gpiod_hog.
gpiod_hog()
> Fixes: bc21077e084b ("gpio: of: Extract of_gpiochip_add_hog()")
>
> Signed-off-by: Tom Rix <trix@...hat.com>
Should be no blank line in between.
> ---
> drivers/gpio/gpiolib-of.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
> index bd31dd3b6a75..277ada41d04a 100644
> --- a/drivers/gpio/gpiolib-of.c
> +++ b/drivers/gpio/gpiolib-of.c
> @@ -657,6 +657,7 @@ static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog)
> int ret;
>
> for (i = 0;; i++) {
> + name = NULL;
> desc = of_parse_own_gpio(hog, chip, i, &name, &lflags, &dflags);
> if (IS_ERR(desc))
> break;
> --
> 2.18.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists