Commit 3d4d3e0a authored by Andy Shevchenko's avatar Andy Shevchenko

pinctrl: st: Convert to use dev_err_probe()

It's fine to call dev_err_probe() in ->probe() when error code is known.
Convert the driver to use dev_err_probe().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3809671d
...@@ -1255,10 +1255,8 @@ static int st_pctl_parse_functions(struct device_node *np, ...@@ -1255,10 +1255,8 @@ static int st_pctl_parse_functions(struct device_node *np,
func = &info->functions[index]; func = &info->functions[index];
func->name = np->name; func->name = np->name;
func->ngroups = of_get_child_count(np); func->ngroups = of_get_child_count(np);
if (func->ngroups == 0) { if (func->ngroups == 0)
dev_err(dev, "No groups defined\n"); return dev_err_probe(dev, -EINVAL, "No groups defined\n");
return -EINVAL;
}
func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL); func->groups = devm_kcalloc(dev, func->ngroups, sizeof(*func->groups), GFP_KERNEL);
if (!func->groups) if (!func->groups)
return -ENOMEM; return -ENOMEM;
...@@ -1555,10 +1553,8 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info, ...@@ -1555,10 +1553,8 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info,
skip_irq: skip_irq:
err = gpiochip_add_data(&bank->gpio_chip, bank); err = gpiochip_add_data(&bank->gpio_chip, bank);
if (err) { if (err)
dev_err(dev, "Failed to add gpiochip(%d)!\n", bank_num); return dev_err_probe(dev, err, "Failed to add gpiochip(%d)!\n", bank_num);
return err;
}
dev_info(dev, "%s bank added.\n", range->name); dev_info(dev, "%s bank added.\n", range->name);
return 0; return 0;
...@@ -1585,10 +1581,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev, ...@@ -1585,10 +1581,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
int irq = 0; int irq = 0;
st_pctl_dt_child_count(info, np); st_pctl_dt_child_count(info, np);
if (!info->nbanks) { if (!info->nbanks)
dev_err(dev, "you need at least one gpio bank\n"); return dev_err_probe(dev, -EINVAL, "you need at least one gpio bank\n");
return -EINVAL;
}
dev_info(dev, "nbanks = %d\n", info->nbanks); dev_info(dev, "nbanks = %d\n", info->nbanks);
dev_info(dev, "nfunctions = %d\n", info->nfunctions); dev_info(dev, "nfunctions = %d\n", info->nfunctions);
...@@ -1604,10 +1598,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev, ...@@ -1604,10 +1598,8 @@ static int st_pctl_probe_dt(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg"); info->regmap = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
if (IS_ERR(info->regmap)) { if (IS_ERR(info->regmap))
dev_err(dev, "No syscfg phandle specified\n"); return dev_err_probe(dev, PTR_ERR(info->regmap), "No syscfg phandle specified\n");
return PTR_ERR(info->regmap);
}
info->data = of_match_node(st_pctl_of_match, np)->data; info->data = of_match_node(st_pctl_of_match, np)->data;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
...@@ -1695,10 +1687,8 @@ static int st_pctl_probe(struct platform_device *pdev) ...@@ -1695,10 +1687,8 @@ static int st_pctl_probe(struct platform_device *pdev)
pctl_desc->name = dev_name(dev); pctl_desc->name = dev_name(dev);
info->pctl = devm_pinctrl_register(dev, pctl_desc, info); info->pctl = devm_pinctrl_register(dev, pctl_desc, info);
if (IS_ERR(info->pctl)) { if (IS_ERR(info->pctl))
dev_err(dev, "Failed pinctrl registration\n"); return dev_err_probe(dev, PTR_ERR(info->pctl), "Failed pinctrl registration\n");
return PTR_ERR(info->pctl);
}
for (i = 0; i < info->nbanks; i++) for (i = 0; i < info->nbanks; i++)
pinctrl_add_gpio_range(info->pctl, &info->banks[i].range); pinctrl_add_gpio_range(info->pctl, &info->banks[i].range);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment