All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn@kryo.se>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpiolib: Fix uninitialized variable warning
Date: Thu, 24 Dec 2015 00:16:42 -0800	[thread overview]
Message-ID: <20151224081642.GA16437@tuxbot> (raw)
In-Reply-To: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com>

On Wed 23 Dec 13:46 PST 2015, Ross Zwisler wrote:

> Commit ef7c7553039b ("gpiolib: improve overlap check of range of gpio")
> introduced the following compiler warning:
> 
> drivers/gpio/gpiolib.c: In function ‘gpiochip_add’:
> drivers/gpio/gpiolib.c:193:20: warning: ‘iterator’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   struct gpio_chip *iterator;
>                     ^
> 
> Fix this by initializing 'iterator' to NULL.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>

Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjorn

> ---
> 
> This was found in next-20151223.
> 
> ---
>  drivers/gpio/gpiolib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index d72ac1f..abdcd6c 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -190,7 +190,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_direction);
>  static int gpiochip_add_to_list(struct gpio_chip *chip)
>  {
>  	struct list_head *pos;
> -	struct gpio_chip *iterator;
> +	struct gpio_chip *iterator = NULL;
>  	struct gpio_chip *previous = NULL;
>  
>  	if (list_empty(&gpio_chips)) {
> -- 
> 2.6.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Bjorn Andersson <bjorn@kryo.se>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpiolib: Fix uninitialized variable warning
Date: Thu, 24 Dec 2015 00:16:42 -0800	[thread overview]
Message-ID: <20151224081642.GA16437@tuxbot> (raw)
In-Reply-To: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com>

On Wed 23 Dec 13:46 PST 2015, Ross Zwisler wrote:

> Commit ef7c7553039b ("gpiolib: improve overlap check of range of gpio")
> introduced the following compiler warning:
> 
> drivers/gpio/gpiolib.c: In function ‘gpiochip_add’:
> drivers/gpio/gpiolib.c:193:20: warning: ‘iterator’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>   struct gpio_chip *iterator;
>                     ^
> 
> Fix this by initializing 'iterator' to NULL.
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>

Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjorn

> ---
> 
> This was found in next-20151223.
> 
> ---
>  drivers/gpio/gpiolib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index d72ac1f..abdcd6c 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -190,7 +190,7 @@ EXPORT_SYMBOL_GPL(gpiod_get_direction);
>  static int gpiochip_add_to_list(struct gpio_chip *chip)
>  {
>  	struct list_head *pos;
> -	struct gpio_chip *iterator;
> +	struct gpio_chip *iterator = NULL;
>  	struct gpio_chip *previous = NULL;
>  
>  	if (list_empty(&gpio_chips)) {
> -- 
> 2.6.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-12-24  8:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-23 21:46 [PATCH] gpiolib: Fix uninitialized variable warning Ross Zwisler
2015-12-23 21:46 ` Ross Zwisler
2015-12-24  8:16 ` Bjorn Andersson [this message]
2015-12-24  8:16   ` Bjorn Andersson
2015-12-24  9:07 ` Linus Walleij
2015-12-24  9:07   ` Linus Walleij

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=20151224081642.GA16437@tuxbot \
    --to=bjorn@kryo.se \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ross.zwisler@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.