mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Reviewed-by: Vladimir Zapolskiy <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
550a9532b8
commit
09e258af4e
1 changed files with 3 additions and 1 deletions
|
|
@ -247,8 +247,10 @@ static int of_gpiochip_scan_gpios(struct gpio_chip *chip)
|
|||
continue;
|
||||
|
||||
ret = gpiod_hog(desc, name, lflags, dflags);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
of_node_put(np);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue