Skip to content

Commit 56c42f6

Browse files
MrVanlinusw
authored andcommitted
pinctrl: rockchip: 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 8c5dc2a commit 56c42f6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/pinctrl/pinctrl-rockchip.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,7 +3044,6 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
30443044
u32 index)
30453045
{
30463046
struct device *dev = info->dev;
3047-
struct device_node *child;
30483047
struct rockchip_pmx_func *func;
30493048
struct rockchip_pin_group *grp;
30503049
int ret;
@@ -3065,14 +3064,12 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
30653064
if (!func->groups)
30663065
return -ENOMEM;
30673066

3068-
for_each_child_of_node(np, child) {
3067+
for_each_child_of_node_scoped(np, child) {
30693068
func->groups[i] = child->name;
30703069
grp = &info->groups[grp_index++];
30713070
ret = rockchip_pinctrl_parse_groups(child, grp, info, i++);
3072-
if (ret) {
3073-
of_node_put(child);
3071+
if (ret)
30743072
return ret;
3075-
}
30763073
}
30773074

30783075
return 0;
@@ -3083,7 +3080,6 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
30833080
{
30843081
struct device *dev = &pdev->dev;
30853082
struct device_node *np = dev->of_node;
3086-
struct device_node *child;
30873083
int ret;
30883084
int i;
30893085

@@ -3102,14 +3098,13 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
31023098

31033099
i = 0;
31043100

3105-
for_each_child_of_node(np, child) {
3101+
for_each_child_of_node_scoped(np, child) {
31063102
if (of_match_node(rockchip_bank_match, child))
31073103
continue;
31083104

31093105
ret = rockchip_pinctrl_parse_functions(child, info, i++);
31103106
if (ret) {
31113107
dev_err(dev, "failed to parse function\n");
3112-
of_node_put(child);
31133108
return ret;
31143109
}
31153110
}

0 commit comments

Comments
 (0)