mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 23:57:36 -04:00
pinctrl: s32cc: use dev_err_probe() and improve error messages
Change dev_err&return statements into dev_err_probe throughout the driver on the probing path. Signed-off-by: Andrei Stefanescu <andrei.stefanescu@oss.nxp.com> Signed-off-by: Khristine Andreea Barbulescu <khristineandreea.barbulescu@oss.nxp.com> Reviewed-by: Enric Balletbo i Serra <eballetb@redhat.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Tested-by: Enric Balletbo i Serra <eballetb@redhat.com> Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit is contained in:
committed by
Linus Walleij
parent
88f643ec10
commit
3f30211b02
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Core driver for the S32 CC (Common Chassis) pin controller
|
||||
*
|
||||
* Copyright 2017-2022,2024 NXP
|
||||
* Copyright 2017-2022,2024-2025 NXP
|
||||
* Copyright (C) 2022 SUSE LLC
|
||||
* Copyright 2015-2016 Freescale Semiconductor, Inc.
|
||||
*/
|
||||
@@ -236,10 +236,10 @@ static int s32_dt_group_node_to_map(struct pinctrl_dev *pctldev,
|
||||
}
|
||||
|
||||
ret = pinconf_generic_parse_dt_config(np, pctldev, &cfgs, &n_cfgs);
|
||||
if (ret) {
|
||||
dev_err(dev, "%pOF: could not parse node property\n", np);
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"%pOF: could not parse node property\n",
|
||||
np);
|
||||
|
||||
if (n_cfgs)
|
||||
reserve++;
|
||||
@@ -763,15 +763,15 @@ static int s32_pinctrl_parse_groups(struct device_node *np,
|
||||
grp->data.name = np->name;
|
||||
|
||||
npins = of_property_count_elems_of_size(np, "pinmux", sizeof(u32));
|
||||
if (npins < 0) {
|
||||
dev_err(dev, "Failed to read 'pinmux' property in node %s.\n",
|
||||
grp->data.name);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!npins) {
|
||||
dev_err(dev, "The group %s has no pins.\n", grp->data.name);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (npins < 0)
|
||||
return dev_err_probe(dev, -EINVAL,
|
||||
"Failed to read 'pinmux' in node %s\n",
|
||||
grp->data.name);
|
||||
|
||||
if (!npins)
|
||||
return dev_err_probe(dev, -EINVAL,
|
||||
"The group %s has no pins\n",
|
||||
grp->data.name);
|
||||
|
||||
grp->data.npins = npins;
|
||||
|
||||
@@ -812,10 +812,9 @@ static int s32_pinctrl_parse_functions(struct device_node *np,
|
||||
/* Initialise function */
|
||||
func->name = np->name;
|
||||
func->ngroups = of_get_child_count(np);
|
||||
if (func->ngroups == 0) {
|
||||
dev_err(info->dev, "no groups defined in %pOF\n", np);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (func->ngroups == 0)
|
||||
return dev_err_probe(info->dev, -EINVAL,
|
||||
"No groups defined in %pOF\n", np);
|
||||
|
||||
groups = devm_kcalloc(info->dev, func->ngroups,
|
||||
sizeof(*func->groups), GFP_KERNEL);
|
||||
@@ -886,10 +885,9 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev,
|
||||
}
|
||||
|
||||
nfuncs = of_get_child_count(np);
|
||||
if (nfuncs <= 0) {
|
||||
dev_err(&pdev->dev, "no functions defined\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (nfuncs <= 0)
|
||||
return dev_err_probe(&pdev->dev, -EINVAL,
|
||||
"No functions defined\n");
|
||||
|
||||
info->nfunctions = nfuncs;
|
||||
info->functions = devm_kcalloc(&pdev->dev, nfuncs,
|
||||
@@ -919,18 +917,17 @@ static int s32_pinctrl_probe_dt(struct platform_device *pdev,
|
||||
int s32_pinctrl_probe(struct platform_device *pdev,
|
||||
const struct s32_pinctrl_soc_data *soc_data)
|
||||
{
|
||||
struct s32_pinctrl *ipctl;
|
||||
int ret;
|
||||
struct pinctrl_desc *s32_pinctrl_desc;
|
||||
struct s32_pinctrl_soc_info *info;
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
struct s32_pinctrl_context *saved_context;
|
||||
#endif
|
||||
struct pinctrl_desc *s32_pinctrl_desc;
|
||||
struct s32_pinctrl_soc_info *info;
|
||||
struct s32_pinctrl *ipctl;
|
||||
int ret;
|
||||
|
||||
if (!soc_data || !soc_data->pins || !soc_data->npins) {
|
||||
dev_err(&pdev->dev, "wrong pinctrl info\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!soc_data || !soc_data->pins || !soc_data->npins)
|
||||
return dev_err_probe(&pdev->dev, -EINVAL,
|
||||
"Wrong pinctrl info\n");
|
||||
|
||||
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
@@ -965,10 +962,9 @@ int s32_pinctrl_probe(struct platform_device *pdev,
|
||||
s32_pinctrl_desc->owner = THIS_MODULE;
|
||||
|
||||
ret = s32_pinctrl_probe_dt(pdev, ipctl);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "fail to probe dt properties\n");
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"Fail to probe dt properties\n");
|
||||
|
||||
ipctl->pctl = devm_pinctrl_register(&pdev->dev, s32_pinctrl_desc,
|
||||
ipctl);
|
||||
|
||||
Reference in New Issue
Block a user