linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powermac: low_i2c: Add missing of_node_put for loop iteration
@ 2021-12-10  8:11 Qing Wang
  0 siblings, 0 replies; only message in thread
From: Qing Wang @ 2021-12-10  8:11 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Michael Ellerman, Paul Mackerras,
	linuxppc-dev, linux-kernel
  Cc: Wang Qing

From: Wang Qing <wangqing@vivo.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@vivo.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-10  8:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-10  8:11 [PATCH] powermac: low_i2c: Add missing of_node_put for loop iteration Qing Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).