Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: ingenic: add missing call to of_node_put()

In one of the error paths of the for_each_child_of_node() loop in
ingenic_gpio_probe, add missing call to of_node_put().

Fix the following coccicheck warning:
./drivers/pinctrl/pinctrl-ingenic.c:2485:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return around
line 2489.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/1614303297-24178-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Yang Li and committed by
Linus Walleij
d2cd54c2 b37c3578

+3 -1
+3 -1
drivers/pinctrl/pinctrl-ingenic.c
··· 2485 2485 for_each_child_of_node(dev->of_node, node) { 2486 2486 if (of_match_node(ingenic_gpio_of_match, node)) { 2487 2487 err = ingenic_gpio_probe(jzpc, node); 2488 - if (err) 2488 + if (err) { 2489 + of_node_put(node); 2489 2490 return err; 2491 + } 2490 2492 } 2491 2493 } 2492 2494