From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bjorn Andersson Subject: Re: [PATCH] gpiolib: Fix uninitialized variable warning Date: Thu, 24 Dec 2015 00:16:42 -0800 Message-ID: <20151224081642.GA16437@tuxbot> References: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail-pa0-f42.google.com ([209.85.220.42]:36606 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754829AbbLXIQq (ORCPT ); Thu, 24 Dec 2015 03:16:46 -0500 Received: by mail-pa0-f42.google.com with SMTP id q3so124908010pav.3 for ; Thu, 24 Dec 2015 00:16:46 -0800 (PST) Content-Disposition: inline In-Reply-To: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com> Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, Bamvor Jian Zhang , Alexandre Courbot , Linus Walleij , linux-gpio@vger.kernel.org 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: >=20 > drivers/gpio/gpiolib.c: In function =91gpiochip_add=92: > drivers/gpio/gpiolib.c:193:20: warning: =91iterator=92 may be used un= initialized in this function [-Wmaybe-uninitialized] > struct gpio_chip *iterator; > ^ >=20 > Fix this by initializing 'iterator' to NULL. >=20 > Signed-off-by: Ross Zwisler Reviewed-by: Bjorn Andersson Regards, Bjorn > --- >=20 > This was found in next-20151223. >=20 > --- > drivers/gpio/gpiolib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 =3D NULL; > struct gpio_chip *previous =3D NULL; > =20 > if (list_empty(&gpio_chips)) { > --=20 > 2.6.3 >=20 > -- > 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" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754900AbbLXIQt (ORCPT ); Thu, 24 Dec 2015 03:16:49 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:36606 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754834AbbLXIQq (ORCPT ); Thu, 24 Dec 2015 03:16:46 -0500 Date: Thu, 24 Dec 2015 00:16:42 -0800 From: Bjorn Andersson To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, Bamvor Jian Zhang , Alexandre Courbot , Linus Walleij , linux-gpio@vger.kernel.org Subject: Re: [PATCH] gpiolib: Fix uninitialized variable warning Message-ID: <20151224081642.GA16437@tuxbot> References: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Bjorn Andersson 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