Skip to content

Commit ee06c78

Browse files
Jinjie Ruanmiquelraynal
authored andcommitted
mtd: rawnand: meson: 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 0d5c32b commit ee06c78

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/mtd/nand/raw/meson_nand.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,14 +1495,12 @@ static int meson_nfc_nand_chips_init(struct device *dev,
14951495
struct meson_nfc *nfc)
14961496
{
14971497
struct device_node *np = dev->of_node;
1498-
struct device_node *nand_np;
14991498
int ret;
15001499

1501-
for_each_child_of_node(np, nand_np) {
1500+
for_each_child_of_node_scoped(np, nand_np) {
15021501
ret = meson_nfc_nand_chip_init(dev, nfc, nand_np);
15031502
if (ret) {
15041503
meson_nfc_nand_chip_cleanup(nfc);
1505-
of_node_put(nand_np);
15061504
return ret;
15071505
}
15081506
}

0 commit comments

Comments
 (0)