@@ -3044,7 +3044,6 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
3044
3044
u32 index )
3045
3045
{
3046
3046
struct device * dev = info -> dev ;
3047
- struct device_node * child ;
3048
3047
struct rockchip_pmx_func * func ;
3049
3048
struct rockchip_pin_group * grp ;
3050
3049
int ret ;
@@ -3065,14 +3064,12 @@ static int rockchip_pinctrl_parse_functions(struct device_node *np,
3065
3064
if (!func -> groups )
3066
3065
return - ENOMEM ;
3067
3066
3068
- for_each_child_of_node (np , child ) {
3067
+ for_each_child_of_node_scoped (np , child ) {
3069
3068
func -> groups [i ] = child -> name ;
3070
3069
grp = & info -> groups [grp_index ++ ];
3071
3070
ret = rockchip_pinctrl_parse_groups (child , grp , info , i ++ );
3072
- if (ret ) {
3073
- of_node_put (child );
3071
+ if (ret )
3074
3072
return ret ;
3075
- }
3076
3073
}
3077
3074
3078
3075
return 0 ;
@@ -3083,7 +3080,6 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
3083
3080
{
3084
3081
struct device * dev = & pdev -> dev ;
3085
3082
struct device_node * np = dev -> of_node ;
3086
- struct device_node * child ;
3087
3083
int ret ;
3088
3084
int i ;
3089
3085
@@ -3102,14 +3098,13 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev,
3102
3098
3103
3099
i = 0 ;
3104
3100
3105
- for_each_child_of_node (np , child ) {
3101
+ for_each_child_of_node_scoped (np , child ) {
3106
3102
if (of_match_node (rockchip_bank_match , child ))
3107
3103
continue ;
3108
3104
3109
3105
ret = rockchip_pinctrl_parse_functions (child , info , i ++ );
3110
3106
if (ret ) {
3111
3107
dev_err (dev , "failed to parse function\n" );
3112
- of_node_put (child );
3113
3108
return ret ;
3114
3109
}
3115
3110
}
0 commit comments