aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2016-10-29 12:13:52 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-10-31 04:23:45 -0400
commit09e258af4edaa10ee9aa3164923ee07d5863d637 (patch)
tree0c4c25acd576b2e9297c7fb2c6a798f09ed7a396 /drivers/gpio
parent550a9532b8093ef554947e5d24b469ffb1ff9930 (diff)
gpio: of: add missing of_node_put() in of_gpiochip_scan_gpios()
When terminating for_each_available_child_of_node() iteration with break or return, of_node_put() should be used to prevent stale device node references from being left behind. This is detected by Coccinelle semantic patch. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-of.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 3fa4e84b4327..5236966b1bdf 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -247,8 +247,10 @@ static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
247 continue; 247 continue;
248 248
249 ret = gpiod_hog(desc, name, lflags, dflags); 249 ret = gpiod_hog(desc, name, lflags, dflags);
250 if (ret < 0) 250 if (ret < 0) {
251 of_node_put(np);
251 return ret; 252 return ret;
253 }
252 } 254 }
253 255
254 return 0; 256 return 0;