Skip to content

Commit 707f2d0

Browse files
Jinjie Ruanmiquelraynal
authored andcommitted
mtd: rawnand: marvell: drm/rockchip: 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 e2e4edd commit 707f2d0

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/mtd/nand/raw/marvell_nand.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,6 @@ static void marvell_nand_chips_cleanup(struct marvell_nfc *nfc)
27712771
static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
27722772
{
27732773
struct device_node *np = dev->of_node;
2774-
struct device_node *nand_np;
27752774
int max_cs = nfc->caps->max_cs_nb;
27762775
int nchips;
27772776
int ret;
@@ -2798,20 +2797,15 @@ static int marvell_nand_chips_init(struct device *dev, struct marvell_nfc *nfc)
27982797
return ret;
27992798
}
28002799

2801-
for_each_child_of_node(np, nand_np) {
2800+
for_each_child_of_node_scoped(np, nand_np) {
28022801
ret = marvell_nand_chip_init(dev, nfc, nand_np);
28032802
if (ret) {
2804-
of_node_put(nand_np);
2805-
goto cleanup_chips;
2803+
marvell_nand_chips_cleanup(nfc);
2804+
return ret;
28062805
}
28072806
}
28082807

28092808
return 0;
2810-
2811-
cleanup_chips:
2812-
marvell_nand_chips_cleanup(nfc);
2813-
2814-
return ret;
28152809
}
28162810

28172811
static int marvell_nfc_init_dma(struct marvell_nfc *nfc)

0 commit comments

Comments
 (0)