Skip to content

Commit 3a88255

Browse files
MrVanlinusw
authored andcommitted
pinctrl: k210: 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 7f500f2 commit 3a88255

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/pinctrl/pinctrl-k210.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,6 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
849849
unsigned int *num_maps)
850850
{
851851
unsigned int reserved_maps;
852-
struct device_node *np;
853852
int ret;
854853

855854
reserved_maps = 0;
@@ -861,13 +860,11 @@ static int k210_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
861860
if (ret < 0)
862861
goto err;
863862

864-
for_each_available_child_of_node(np_config, np) {
863+
for_each_available_child_of_node_scoped(np_config, np) {
865864
ret = k210_pinctrl_dt_subnode_to_map(pctldev, np, map,
866865
&reserved_maps, num_maps);
867-
if (ret < 0) {
868-
of_node_put(np);
866+
if (ret < 0)
869867
goto err;
870-
}
871868
}
872869
return 0;
873870

0 commit comments

Comments
 (0)