diff mbox series

ARM: OMAP2+: hwmod: Add of_node_put() before break

Message ID 20211014085719.23739-1-wanjiabing@vivo.com (mailing list archive)
State New, archived
Headers show
Series ARM: OMAP2+: hwmod: Add of_node_put() before break | expand

Commit Message

Jiabing Wan Oct. 14, 2021, 8:57 a.m. UTC
Fix following coccicheck warning:
./arch/arm/mach-omap2/omap_hwmod.c:753:1-23: WARNING: Function
for_each_matching_node should have of_node_put() before break

Early exits from for_each_matching_node should decrement the
node reference counter.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 arch/arm/mach-omap2/omap_hwmod.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Tony Lindgren Dec. 17, 2021, 12:14 p.m. UTC | #1
* Wan Jiabing <wanjiabing@vivo.com> [211014 11:58]:
> Fix following coccicheck warning:
> ./arch/arm/mach-omap2/omap_hwmod.c:753:1-23: WARNING: Function
> for_each_matching_node should have of_node_put() before break
> 
> Early exits from for_each_matching_node should decrement the
> node reference counter.

Thanks adding into omap-for-v5.17/fixes-not-urgent.

Tony
diff mbox series

Patch

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index ccb0e3732c0d..31d1a21f6041 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -752,8 +752,10 @@  static int __init _init_clkctrl_providers(void)
 
 	for_each_matching_node(np, ti_clkctrl_match_table) {
 		ret = _setup_clkctrl_provider(np);
-		if (ret)
+		if (ret) {
+			of_node_put(np);
 			break;
+		}
 	}
 
 	return ret;