[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1639123911-31736-1-git-send-email-wangqing@vivo.com>
Date: Fri, 10 Dec 2021 00:11:51 -0800
From: Qing Wang <wangqing@...o.com>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Michael Ellerman <mpe@...erman.id.au>,
Paul Mackerras <paulus@...ba.org>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Cc: Wang Qing <wangqing@...o.com>
Subject: [PATCH] powermac: low_i2c: Add missing of_node_put for loop iteration
From: Wang Qing <wangqing@...o.com>
for_each_available_child_of_node() should decrement the
node reference counter. Reported by Coccinelle:
arch/powerpc/platforms/powermac/low_i2c.c:916:1-23: WARNING: Function
"for_each_child_of_node" should have of_node_put() before return.
Signed-off-by: Wang Qing <wangqing@...o.com>
---
arch/powerpc/platforms/powermac/low_i2c.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index f77a59b..5a8c306
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -922,8 +922,10 @@ static void __init smu_i2c_probe(void)
sz = sizeof(struct pmac_i2c_bus) + sizeof(struct smu_i2c_cmd);
bus = kzalloc(sz, GFP_KERNEL);
- if (bus == NULL)
+ if (bus == NULL) {
+ of_node_put(busnode);
return;
+ }
bus->controller = controller;
bus->busnode = of_node_get(busnode);
--
2.7.4
Powered by blists - more mailing lists