Skip to content

Commit f3b3c47

Browse files
Jinjie Ruanmiquelraynal
authored andcommitted
mtd: rawnand: renesas: 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]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 8795952 commit f3b3c47

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,23 +1297,17 @@ static void rnandc_chips_cleanup(struct rnandc *rnandc)
12971297

12981298
static int rnandc_chips_init(struct rnandc *rnandc)
12991299
{
1300-
struct device_node *np;
13011300
int ret;
13021301

1303-
for_each_child_of_node(rnandc->dev->of_node, np) {
1302+
for_each_child_of_node_scoped(rnandc->dev->of_node, np) {
13041303
ret = rnandc_chip_init(rnandc, np);
13051304
if (ret) {
1306-
of_node_put(np);
1307-
goto cleanup_chips;
1305+
rnandc_chips_cleanup(rnandc);
1306+
return ret;
13081307
}
13091308
}
13101309

13111310
return 0;
1312-
1313-
cleanup_chips:
1314-
rnandc_chips_cleanup(rnandc);
1315-
1316-
return ret;
13171311
}
13181312

13191313
static int rnandc_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)