[PATCH] gpiolib: Fix uninitialized variable warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux