pinctrl: samsung: exynos: Add of_node_put() before return
Subsystems (4)
PATCH 1/1 pinctrl: samsung: exynos: Add of_node_put() before return
Each iteration of for_each_child_of_node puts the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the return. Issue found with Coccinelle.
--- drivers/pinctrl/samsung/pinctrl-exynos.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/samsung/pinctrl-exynos.c +3 -1
@@ -486,8 +486,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)if (match) { irq_chip =kmemdup (match->data,sizeof (*irq_chip),GFP_KERNEL ); -if (!irq_chip) +if (!irq_chip) { +of_node_put (np);return -ENOMEM ; + } wkup_np = np;break ; }
Signature · 1 line
2.19.1
Quoted 8 lines · Nishka Dasgupta
Each iteration of
for_each_child_of_nodeputs the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence add anof_node_putbefore the return. Issue found with Coccinelle.Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/pinctrl/samsung/pinctrl-exynos.c | 4 +++-
Thanks, applied.
Best regards,
Krzysztof
Krzysztof Kozlowski
maintainerQuoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Nishka Dasgupta
Each iteration of
for_each_child_of_nodeputs the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence add anof_node_putbefore the return. Issue found with Coccinelle.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Nishka Dasgupta <[email protected]>--- drivers/pinctrl/samsung/pinctrl-exynos.c | 4 +++-Thanks, applied.
Hi Nishka,
I am sorry but I missed the v5.4 merge window and did not push this to Linus. It's my fault. I'll push it this time, for v5.5 (no need for action from your side).
Best regards,
Krzysztof