Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

memory: atmel-ebi: add missing of_node_put for loop iteration

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

+3 -1
+3 -1
drivers/memory/atmel-ebi.c
··· 600 600 child); 601 601 602 602 ret = atmel_ebi_dev_disable(ebi, child); 603 - if (ret) 603 + if (ret) { 604 + of_node_put(child); 604 605 return ret; 606 + } 605 607 } 606 608 } 607 609