Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1297780
| From | Bjorn Andersson <bjorn@kryo.se> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] gpiolib: Fix uninitialized variable warning |
| Date | 2015-12-24 09:20 +0100 |
| Message-ID | <qJ9hU-4kG-5@gated-at.bofh.it> (permalink) |
| References | <qIZsd-6sP-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] gpiolib: Fix uninitialized variable warning Ross Zwisler <ross.zwisler@linux.intel.com> - 2015-12-23 22:50 +0100 Re: [PATCH] gpiolib: Fix uninitialized variable warning Bjorn Andersson <bjorn@kryo.se> - 2015-12-24 09:20 +0100 Re: [PATCH] gpiolib: Fix uninitialized variable warning Linus Walleij <linus.walleij@linaro.org> - 2015-12-24 10:10 +0100
csiph-web