Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20240826092734.2899562-2-ruanjinjie@huawei.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Jinjie Ruan and committed by
Lee Jones
0db28e96 ae7eee56

+2 -3
+2 -3
drivers/mfd/max77620.c
··· 400 400 static int max77620_initialise_fps(struct max77620_chip *chip) 401 401 { 402 402 struct device *dev = chip->dev; 403 - struct device_node *fps_np, *fps_child; 403 + struct device_node *fps_np; 404 404 u8 config; 405 405 int fps_id; 406 406 int ret; ··· 414 414 if (!fps_np) 415 415 goto skip_fps; 416 416 417 - for_each_child_of_node(fps_np, fps_child) { 417 + for_each_child_of_node_scoped(fps_np, fps_child) { 418 418 ret = max77620_config_fps(chip, fps_child); 419 419 if (ret < 0) { 420 - of_node_put(fps_child); 421 420 of_node_put(fps_np); 422 421 return ret; 423 422 }