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

pinctrl: pinconf-generic: Use scope based of_node_put() cleanups

Use scope based of_node_put() cleanup to simplify code.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/20240504-pinctrl-cleanup-v2-17-26c5f2dc1181@nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Peng Fan and committed by
Linus Walleij
d7f5120a 240c5f23

+2 -5
+2 -5
drivers/pinctrl/pinconf-generic.c
··· 382 382 unsigned int *num_maps, enum pinctrl_map_type type) 383 383 { 384 384 unsigned int reserved_maps; 385 - struct device_node *np; 386 385 int ret; 387 386 388 387 reserved_maps = 0; ··· 393 394 if (ret < 0) 394 395 goto exit; 395 396 396 - for_each_available_child_of_node(np_config, np) { 397 + for_each_available_child_of_node_scoped(np_config, np) { 397 398 ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map, 398 399 &reserved_maps, num_maps, type); 399 - if (ret < 0) { 400 - of_node_put(np); 400 + if (ret < 0) 401 401 goto exit; 402 - } 403 402 } 404 403 return 0; 405 404