Skip to content

Commit 0db28e9

Browse files
Jinjie Ruanlag-linaro
authored andcommitted
mfd: max77620: 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]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent ae7eee5 commit 0db28e9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/mfd/max77620.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
400400
static int max77620_initialise_fps(struct max77620_chip *chip)
401401
{
402402
struct device *dev = chip->dev;
403-
struct device_node *fps_np, *fps_child;
403+
struct device_node *fps_np;
404404
u8 config;
405405
int fps_id;
406406
int ret;
@@ -414,10 +414,9 @@ static int max77620_initialise_fps(struct max77620_chip *chip)
414414
if (!fps_np)
415415
goto skip_fps;
416416

417-
for_each_child_of_node(fps_np, fps_child) {
417+
for_each_child_of_node_scoped(fps_np, fps_child) {
418418
ret = max77620_config_fps(chip, fps_child);
419419
if (ret < 0) {
420-
of_node_put(fps_child);
421420
of_node_put(fps_np);
422421
return ret;
423422
}

0 commit comments

Comments
 (0)