All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpiolib: Fix uninitialized variable warning
@ 2015-12-23 21:46 ` Ross Zwisler
  0 siblings, 0 replies; 6+ messages in thread
From: Ross Zwisler @ 2015-12-23 21:46 UTC (permalink / raw)
  To: linux-kernel, Bamvor Jian Zhang
  Cc: Ross Zwisler, Alexandre Courbot, Linus Walleij, linux-gpio

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>
---

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] gpiolib: Fix uninitialized variable warning
@ 2015-12-23 21:46 ` Ross Zwisler
  0 siblings, 0 replies; 6+ messages in thread
From: Ross Zwisler @ 2015-12-23 21:46 UTC (permalink / raw)
  To: linux-kernel, Bamvor Jian Zhang
  Cc: Ross Zwisler, Alexandre Courbot, Linus Walleij, linux-gpio

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>
---

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: Fix uninitialized variable warning
  2015-12-23 21:46 ` Ross Zwisler
@ 2015-12-24  8:16   ` Bjorn Andersson
  -1 siblings, 0 replies; 6+ messages in thread
From: Bjorn Andersson @ 2015-12-24  8:16 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Bamvor Jian Zhang, Alexandre Courbot, Linus Walleij,
	linux-gpio

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: Fix uninitialized variable warning
@ 2015-12-24  8:16   ` Bjorn Andersson
  0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Andersson @ 2015-12-24  8:16 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Bamvor Jian Zhang, Alexandre Courbot, Linus Walleij,
	linux-gpio

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: Fix uninitialized variable warning
  2015-12-23 21:46 ` Ross Zwisler
@ 2015-12-24  9:07   ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-12-24  9:07 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel@vger.kernel.org, Bamvor Jian Zhang,
	Alexandre Courbot, linux-gpio@vger.kernel.org

On Wed, Dec 23, 2015 at 10:46 PM, Ross Zwisler
<ross.zwisler@linux.intel.com> 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>
> ---
>
> This was found in next-20151223.

Several people reported this and I was waiting for a proper
fix from Bamvor (as it is a false compile warning and doesn't
really indicate a real error) but now I'll apply this to
get rid of all the reports and patches filling my mailbox...

Merry Christmas!

Yours,
Linus Walleij
--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gpiolib: Fix uninitialized variable warning
@ 2015-12-24  9:07   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-12-24  9:07 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel@vger.kernel.org, Bamvor Jian Zhang,
	Alexandre Courbot, linux-gpio@vger.kernel.org

On Wed, Dec 23, 2015 at 10:46 PM, Ross Zwisler
<ross.zwisler@linux.intel.com> 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>
> ---
>
> This was found in next-20151223.

Several people reported this and I was waiting for a proper
fix from Bamvor (as it is a false compile warning and doesn't
really indicate a real error) but now I'll apply this to
get rid of all the reports and patches filling my mailbox...

Merry Christmas!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-24  9:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-12-24  8:16   ` Bjorn Andersson
2015-12-24  9:07 ` Linus Walleij
2015-12-24  9:07   ` Linus Walleij

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.