Skip to content

Commit 794e5dc

Browse files
MrVanlinusw
authored andcommitted
pinctrl: sprd: 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 8fa99c0 commit 794e5dc

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/pinctrl/sprd/pinctrl-sprd.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,6 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl)
934934
{
935935
struct sprd_pinctrl_soc_info *info = sprd_pctl->info;
936936
struct device_node *np = sprd_pctl->dev->of_node;
937-
struct device_node *child, *sub_child;
938937
struct sprd_pin_group *grp;
939938
const char **temp;
940939
int ret;
@@ -962,25 +961,20 @@ static int sprd_pinctrl_parse_dt(struct sprd_pinctrl *sprd_pctl)
962961
temp = info->grp_names;
963962
grp = info->groups;
964963

965-
for_each_child_of_node(np, child) {
964+
for_each_child_of_node_scoped(np, child) {
966965
ret = sprd_pinctrl_parse_groups(child, sprd_pctl, grp);
967-
if (ret) {
968-
of_node_put(child);
966+
if (ret)
969967
return ret;
970-
}
971968

972969
*temp++ = grp->name;
973970
grp++;
974971

975972
if (of_get_child_count(child) > 0) {
976-
for_each_child_of_node(child, sub_child) {
973+
for_each_child_of_node_scoped(child, sub_child) {
977974
ret = sprd_pinctrl_parse_groups(sub_child,
978975
sprd_pctl, grp);
979-
if (ret) {
980-
of_node_put(sub_child);
981-
of_node_put(child);
976+
if (ret)
982977
return ret;
983-
}
984978

985979
*temp++ = grp->name;
986980
grp++;

0 commit comments

Comments
 (0)