pinctrl: freescale: mxs: Fix refcount of child
authorPeng Fan <peng.fan@nxp.com>
Sat, 4 May 2024 13:20:16 +0000 (21:20 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 26 Jun 2024 09:59:31 +0000 (11:59 +0200)
commit7f500f2011c0bbb6e1cacab74b4c99222e60248e
tree6124765f79429f30d9e0efc83bf7aaaec65dc3fe
parentd7f5120a944a5b515d6307c8cbfcd4f1fde543fb
pinctrl: freescale: mxs: Fix refcount of child

of_get_next_child() will increase refcount of the returned node, need
use of_node_put() on it when done.

Per current implementation, 'child' will be override by
for_each_child_of_node(np, child), so use of_get_child_count to avoid
refcount leakage.

Fixes: 17723111e64f ("pinctrl: add pinctrl-mxs support")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/20240504-pinctrl-cleanup-v2-18-26c5f2dc1181@nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/freescale/pinctrl-mxs.c