diff options
author | Wang Qing <wangqing@vivo.com> | 2021-12-13 10:42:24 +0100 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2022-04-21 13:47:15 +0200 |
commit | 883f464c1d23663047eda4f2bcf622365e2d0dd0 (patch) | |
tree | 3f95b562f739e90ed02ea48ea451c2e7792eb378 /arch/arm/mach-omap2/control.c | |
parent | iommu/omap: Fix regression in probe for NULL pointer dereference (diff) | |
download | linux-883f464c1d23663047eda4f2bcf622365e2d0dd0.tar.xz linux-883f464c1d23663047eda4f2bcf622365e2d0dd0.zip |
ARM: OMAP2+: add missing of_node_put before break and return
Fix following coccicheck warning:
WARNING: Function "for_each_matching_node_and_match"
should have of_node_put() before return.
Early exits from for_each_matching_node_and_match should decrement the
node reference counter.
Signed-off-by: Wang Qing <wangqing@vivo.com>
Message-Id: <1639388545-63615-1-git-send-email-wangqing@vivo.com>
[tony@atomide.com: updated for omap_hwmod.c that was already patched]
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/control.c')
-rw-r--r-- | arch/arm/mach-omap2/control.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 062d431fc33a..c514a9602269 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c @@ -769,8 +769,10 @@ int __init omap2_control_base_init(void) data = (struct control_init_data *)match->data; mem = of_iomap(np, 0); - if (!mem) + if (!mem) { + of_node_put(np); return -ENOMEM; + } if (data->index == TI_CLKM_CTRL) { omap2_ctrl_base = mem; @@ -810,22 +812,24 @@ int __init omap_control_init(void) if (scm_conf) { syscon = syscon_node_to_regmap(scm_conf); - if (IS_ERR(syscon)) - return PTR_ERR(syscon); + if (IS_ERR(syscon)) { + ret = PTR_ERR(syscon); + goto of_node_put; + } if (of_get_child_by_name(scm_conf, "clocks")) { ret = omap2_clk_provider_init(scm_conf, data->index, syscon, NULL); if (ret) - return ret; + goto of_node_put; } } else { /* No scm_conf found, direct access */ ret = omap2_clk_provider_init(np, data->index, NULL, data->mem); if (ret) - return ret; + goto of_node_put; } } @@ -836,6 +840,11 @@ int __init omap_control_init(void) } return 0; + +of_node_put: + of_node_put(np); + return ret; + } /** |