summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/freescale/pinctrl-mxs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/freescale/pinctrl-mxs.c')
-rw-r--r--drivers/pinctrl/freescale/pinctrl-mxs.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index e77311f26262..edb242d30609 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -413,8 +413,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
int ret;
u32 val;
- child = of_get_next_child(np, NULL);
- if (!child) {
+ val = of_get_child_count(np);
+ if (val == 0) {
dev_err(&pdev->dev, "no group is defined\n");
return -ENOENT;
}
@@ -490,16 +490,14 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
/* Get groups for each function */
idxf = 0;
fn = fnull;
- for_each_child_of_node(np, child) {
+ for_each_child_of_node_scoped(np, child) {
if (is_mxs_gpio(child))
continue;
if (of_property_read_u32(child, "reg", &val)) {
ret = mxs_pinctrl_parse_group(pdev, child,
idxg++, NULL);
- if (ret) {
- of_node_put(child);
+ if (ret)
return ret;
- }
continue;
}
@@ -509,19 +507,15 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
f->ngroups,
sizeof(*f->groups),
GFP_KERNEL);
- if (!f->groups) {
- of_node_put(child);
+ if (!f->groups)
return -ENOMEM;
- }
fn = child->name;
i = 0;
}
ret = mxs_pinctrl_parse_group(pdev, child, idxg++,
&f->groups[i++]);
- if (ret) {
- of_node_put(child);
+ if (ret)
return ret;
- }
}
return 0;