Skip to content

Commit 7021a79

Browse files
Jinjie Ruanmiquelraynal
authored andcommitted
mtd: rawnand: arasan: Use for_each_child_of_node_scoped()
Avoids the need for manual cleanup of_node_put() in early exits from the loop. Signed-off-by: Jinjie Ruan <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 3c0e167 commit 7021a79

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ static void anfc_chips_cleanup(struct arasan_nfc *nfc)
13601360

13611361
static int anfc_chips_init(struct arasan_nfc *nfc)
13621362
{
1363-
struct device_node *np = nfc->dev->of_node, *nand_np;
1363+
struct device_node *np = nfc->dev->of_node;
13641364
int nchips = of_get_child_count(np);
13651365
int ret;
13661366

@@ -1370,10 +1370,9 @@ static int anfc_chips_init(struct arasan_nfc *nfc)
13701370
return -EINVAL;
13711371
}
13721372

1373-
for_each_child_of_node(np, nand_np) {
1373+
for_each_child_of_node_scoped(np, nand_np) {
13741374
ret = anfc_chip_init(nfc, nand_np);
13751375
if (ret) {
1376-
of_node_put(nand_np);
13771376
anfc_chips_cleanup(nfc);
13781377
break;
13791378
}

0 commit comments

Comments
 (0)