Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965726AbbLWVqe (ORCPT ); Wed, 23 Dec 2015 16:46:34 -0500 Received: from mga09.intel.com ([134.134.136.24]:60664 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932483AbbLWVqc (ORCPT ); Wed, 23 Dec 2015 16:46:32 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,470,1444719600"; d="scan'208";a="713734285" From: Ross Zwisler To: linux-kernel@vger.kernel.org, Bamvor Jian Zhang Cc: Ross Zwisler , Alexandre Courbot , Linus Walleij , linux-gpio@vger.kernel.org Subject: [PATCH] gpiolib: Fix uninitialized variable warning Date: Wed, 23 Dec 2015 14:46:17 -0700 Message-Id: <1450907177-31529-1-git-send-email-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.6.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1263 Lines: 40 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 --- 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-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/