Skip to content

Commit d7f5120

Browse files
MrVanlinusw
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 240c5f2 commit d7f5120

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/pinctrl/pinconf-generic.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
382382
unsigned int *num_maps, enum pinctrl_map_type type)
383383
{
384384
unsigned int reserved_maps;
385-
struct device_node *np;
386385
int ret;
387386

388387
reserved_maps = 0;
@@ -394,13 +393,11 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
394393
if (ret < 0)
395394
goto exit;
396395

397-
for_each_available_child_of_node(np_config, np) {
396+
for_each_available_child_of_node_scoped(np_config, np) {
398397
ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map,
399398
&reserved_maps, num_maps, type);
400-
if (ret < 0) {
401-
of_node_put(np);
399+
if (ret < 0)
402400
goto exit;
403-
}
404401
}
405402
return 0;
406403

0 commit comments

Comments
 (0)