Skip to contentSkip to conversation

mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands

PATCH New Erick Karanja 1 participant 1 message Sep 21, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands

If atmel_nand_create() fails, then reference to "nand_np" still need to be released.

Use for_each_child_of_node_scoped() to fix the issue.

Fixes f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
---
 drivers/mtd/nand/raw/atmel/nand-controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +1 -1
index db94d14a3807..a73c44d79e1b 100644
@@ -1885,7 +1885,7 @@ static int atmel_nand_controller_add_nands(struct atmel_nand_controller *nc)
 
 	reg_cells += val;
 
-	for_each_child_of_node(np, nand_np) {
+	for_each_child_of_node_scoped(np, nand_np) {
 		struct atmel_nand *nand;
 
 		nand = atmel_nand_create(nc, nand_np, reg_cells);
Signature · 1 line
2.43.0