Skip to content

Commit b59fdc7

Browse files
Jinjie Ruanmiquelraynal
authored andcommitted
mtd: rawnand: sunxi: 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 f5b30c7 commit b59fdc7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/mtd/nand/raw/sunxi_nand.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,13 +2025,11 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
20252025
static int sunxi_nand_chips_init(struct device *dev, struct sunxi_nfc *nfc)
20262026
{
20272027
struct device_node *np = dev->of_node;
2028-
struct device_node *nand_np;
20292028
int ret;
20302029

2031-
for_each_child_of_node(np, nand_np) {
2030+
for_each_child_of_node_scoped(np, nand_np) {
20322031
ret = sunxi_nand_chip_init(dev, nfc, nand_np);
20332032
if (ret) {
2034-
of_node_put(nand_np);
20352033
sunxi_nand_chips_cleanup(nfc);
20362034
return ret;
20372035
}

0 commit comments

Comments
 (0)