[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1639388769-64240-1-git-send-email-wangqing@vivo.com>
Date: Mon, 13 Dec 2021 01:46:09 -0800
From: Qing Wang <wangqing@...o.com>
To: Andrew Lunn <andrew@...n.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Gregory Clement <gregory.clement@...tlin.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: Wang Qing <wangqing@...o.com>
Subject: [PATCH] soc: dove: add missing of_node_put before break
From: Wang Qing <wangqing@...o.com>
Fix following coccicheck warning:
WARNING: Function "for_each_available_child_of_node"
should have of_node_put() before return.
Early exits from for_each_available_child_of_node should decrement the
node reference counter.
Signed-off-by: Wang Qing <wangqing@...o.com>
---
drivers/soc/dove/pmu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/dove/pmu.c b/drivers/soc/dove/pmu.c
index ffc5311..6202dbc
--- a/drivers/soc/dove/pmu.c
+++ b/drivers/soc/dove/pmu.c
@@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
struct pmu_domain *domain;
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
- if (!domain)
+ if (!domain) {
+ of_node_put(np);
break;
+ }
domain->pmu = pmu;
domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
if (!domain->base.name) {
kfree(domain);
+ of_node_put(np);
break;
}
--
2.7.4
Powered by blists - more mailing lists