Skip to content

Commit 8ed4728

Browse files
Erickkaranjamiquelraynal
authored andcommitted
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. Fixes: f88fc12 ("mtd: nand: Cleanup/rework the atmel_nand driver") Signed-off-by: Erick Karanja <karanja99erick@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 3148d0e commit 8ed4728

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/mtd/nand/raw/atmel/nand-controller.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ atmel_nand_controller_legacy_add_nands(struct atmel_nand_controller *nc)
18531853

18541854
static int atmel_nand_controller_add_nands(struct atmel_nand_controller *nc)
18551855
{
1856-
struct device_node *np, *nand_np;
1856+
struct device_node *np;
18571857
struct device *dev = nc->dev;
18581858
int ret, reg_cells;
18591859
u32 val;
@@ -1880,7 +1880,7 @@ static int atmel_nand_controller_add_nands(struct atmel_nand_controller *nc)
18801880

18811881
reg_cells += val;
18821882

1883-
for_each_child_of_node(np, nand_np) {
1883+
for_each_child_of_node_scoped(np, nand_np) {
18841884
struct atmel_nand *nand;
18851885

18861886
nand = atmel_nand_create(nc, nand_np, reg_cells);

0 commit comments

Comments
 (0)