mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands
Subsystems (4)
PATCH 1/1 mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands
In case of a jump to the err label due to atmel_nand_create() or atmel_nand_controller_add_nand() failure, the reference to nand_np need to be released
Use for_each_child_of_node_scoped() to fix the issue.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +2 -2
@@ -1858,7 +1858,7 @@ atmel_nand_controller_legacy_add_nands(struct atmel_nand_controller *nc)static int atmel_nand_controller_add_nands (struct atmel_nand_controller *nc) { -struct device_node *np, *nand_np; +struct device_node *np;struct device *dev = nc->dev;int ret, reg_cells;u32 val;
@@ -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
Quoted 9 lines · Erick Karanja
In case of a jump to the err label due to
atmel_nand_create()oratmel_nand_controller_add_nand()failure, the reference tonand_npneed to be releasedUse
for_each_child_of_node_scoped()to fix the issue.Fixes f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")[...]
Applied to nand/next, thanks!
[1/1] mtd: rawnand: atmel: Fix error handling path in atmel_nand_controller_add_nands
commit: 8ed4728eb9f10b57c3eb02e0f6933a89ffcb8a91
Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl