summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2024-05-04 21:20:04 +0800
committerLinus Walleij <linus.walleij@linaro.org>2024-06-26 11:56:15 +0200
commit8c5dc2a5b3a76f1ebf483dd2e3514746e97898cd (patch)
tree9c13178eb818b2e72ecdf6c9b002d0e5ecbed3fd /drivers/pinctrl
parent794e5dc533b070012d8e3cc9bf115596371ac040 (diff)
downloadlwn-8c5dc2a5b3a76f1ebf483dd2e3514746e97898cd.tar.gz
lwn-8c5dc2a5b3a76f1ebf483dd2e3514746e97898cd.zip
pinctrl: spear: 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-6-26c5f2dc1181@nxp.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index b8caaa5a2d4e..a8c5fe973cd4 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -151,24 +151,19 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
unsigned *num_maps)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
- struct device_node *np;
struct property *prop;
const char *function, *group;
int ret, index = 0, count = 0;
/* calculate number of maps required */
- for_each_child_of_node(np_config, np) {
+ for_each_child_of_node_scoped(np_config, np) {
ret = of_property_read_string(np, "st,function", &function);
- if (ret < 0) {
- of_node_put(np);
+ if (ret < 0)
return ret;
- }
ret = of_property_count_strings(np, "st,pins");
- if (ret < 0) {
- of_node_put(np);
+ if (ret < 0)
return ret;
- }
count += ret;
}
@@ -182,7 +177,7 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
if (!*map)
return -ENOMEM;
- for_each_child_of_node(np_config, np) {
+ for_each_child_of_node_scoped(np_config, np) {
of_property_read_string(np, "st,function", &function);
of_property_for_each_string(np, "st,pins", prop, group) {
(*map)[index].type = PIN_MAP_TYPE_MUX_GROUP;