gpio: gpiolib-of.c: Add of_node_put() before break
PATCH 1/1 gpio: gpiolib-of.c: Add of_node_put() before break
Each iteration of for_each_child_of_node puts the previous node, but in the case of a break from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the break. Issue found with Coccinelle.
Signed-off-by Nishka Dasgupta <[email protected]>
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-of.c +1 -0
@@ -154,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np, of_node_full_name(child)); *flags |=OF_GPIO_ACTIVE_LOW ; } +of_node_put (child);break ; } }
Signature · 1 line
2.19.1
sob., 6 lip 2019 o 15:34 Nishka Dasgupta <[email protected]> napisał(a):
Quoted 24 lines
Each iteration of
for_each_child_of_nodeputs the previous node, but in the case of a break from the middle of the loop, there is no put, thus causing a memory leak. Hence add anof_node_putbefore the break. Issue found with Coccinelle.Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)drivers/gpio/gpiolib-of.c +1
-1@@ -154,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np, of_node_full_name(child)); *flags |=OF_GPIO_ACTIVE_LOW ; } +of_node_put (child);break ; } } --
Quoted 2 lines
2.19.1
Applied for fixes with a slightly changed commit message. Thanks!
Bartosz