Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: sprd: Use scope based of_node_put() cleanups

Use scope based of_node_put() cleanup to simplify code.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/20240504-pinctrl-cleanup-v2-5-26c5f2dc1181@nxp.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Peng Fan and committed by
Linus Walleij
794e5dc5 8fa99c00

+4 -10
+4 -10
drivers/pinctrl/sprd/pinctrl-sprd.c
··· 934 934 { 935 935 struct sprd_pinctrl_soc_info *info = sprd_pctl->info; 936 936 struct device_node *np = sprd_pctl->dev->of_node; 937 - struct device_node *child, *sub_child; 938 937 struct sprd_pin_group *grp; 939 938 const char **temp; 940 939 int ret; ··· 961 962 temp = info->grp_names; 962 963 grp = info->groups; 963 964 964 - for_each_child_of_node(np, child) { 965 + for_each_child_of_node_scoped(np, child) { 965 966 ret = sprd_pinctrl_parse_groups(child, sprd_pctl, grp); 966 - if (ret) { 967 - of_node_put(child); 967 + if (ret) 968 968 return ret; 969 - } 970 969 971 970 *temp++ = grp->name; 972 971 grp++; 973 972 974 973 if (of_get_child_count(child) > 0) { 975 - for_each_child_of_node(child, sub_child) { 974 + for_each_child_of_node_scoped(child, sub_child) { 976 975 ret = sprd_pinctrl_parse_groups(sub_child, 977 976 sprd_pctl, grp); 978 - if (ret) { 979 - of_node_put(sub_child); 980 - of_node_put(child); 977 + if (ret) 981 978 return ret; 982 - } 983 979 984 980 *temp++ = grp->name; 985 981 grp++;