Blob Blame History Raw
From 907c5bbb514a4676160e79764522fff56ce3448e Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Date: Fri, 23 Apr 2021 12:18:15 +0200
Subject: [PATCH] memory: atmel-ebi: add missing of_node_put for loop iteration
Git-commit: 907c5bbb514a4676160e79764522fff56ce3448e
Patch-mainline: v5.14-rc1
References: git-fixes

Early exits from for_each_available_child_of_node() should decrement the
node reference counter.  Reported by Coccinelle:

  drivers/memory/atmel-ebi.c:593:1-33: WARNING:
    Function "for_each_available_child_of_node" should have of_node_put() before return around line 604.

Fixes: 6a4ec4cd0888 ("memory: add Atmel EBI (External Bus Interface) driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210423101815.119341-2-krzysztof.kozlowski@canonical.com
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/memory/atmel-ebi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -573,8 +573,10 @@ static int atmel_ebi_probe(struct platfo
 				child->full_name);
 
 			ret = atmel_ebi_dev_disable(ebi, child);
-			if (ret)
+			if (ret) {
+				of_node_put(child);
 				return ret;
+			}
 		}
 	}