Thread (40 messages) 40 messages, 6 authors, 2015-08-10
STALE3962d
Revisions (3)
  1. v1 current
  2. v1 [diff vs current]
  3. v3 [diff vs current]

[PATCH 1/9] gpiolib: Fix possible use of wrong name

From: Markus Pargmann <hidden>
Date: 2015-07-17 09:33:41
Also in: linux-gpio
Subsystem: gpio subsystem, the rest · Maintainers: Linus Walleij, Bartosz Golaszewski, Linus Torvalds

The name is set optionally from DT. Therefore we need to reset the name
variable for every loop iteration. Otherwise we could use a wrong or
uninitialized name.

Signed-off-by: Markus Pargmann <redacted>
---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 9a0ec48a4737..60aebe4d7c26 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -209,11 +209,11 @@ static void of_gpiochip_scan_hogs(struct gpio_chip *chip)
 {
 	struct gpio_desc *desc = NULL;
 	struct device_node *np;
-	const char *name;
 	enum gpio_lookup_flags lflags;
 	enum gpiod_flags dflags;
 
 	for_each_child_of_node(chip->of_node, np) {
+		const char *name = NULL;
 		if (!of_property_read_bool(np, "gpio-hog"))
 			continue;
 
-- 
2.1.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help