Skip to content

Commit 8795952

Browse files
Jinjie Ruanmiquelraynal
authored andcommitted
mtd: rawnand: mtk: 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 ee06c78 commit 8795952

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/mtd/nand/raw/mtk_nand.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,15 +1432,12 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
14321432
static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)
14331433
{
14341434
struct device_node *np = dev->of_node;
1435-
struct device_node *nand_np;
14361435
int ret;
14371436

1438-
for_each_child_of_node(np, nand_np) {
1437+
for_each_child_of_node_scoped(np, nand_np) {
14391438
ret = mtk_nfc_nand_chip_init(dev, nfc, nand_np);
1440-
if (ret) {
1441-
of_node_put(nand_np);
1439+
if (ret)
14421440
return ret;
1443-
}
14441441
}
14451442

14461443
return 0;

0 commit comments

Comments
 (0)