[PATCH v9 1/7] pinctrl: s32cc: use dev_err_probe() and improve error messages

Enric Balletbo i Serra eballetb at redhat.com
Tue May 19 04:12:35 PDT 2026


Hi,

On Mon, May 4, 2026 at 3:12 PM Khristine Andreea Barbulescu
<khristineandreea.barbulescu at oss.nxp.com> wrote:
>
> Change dev_err&return statements into dev_err_probe throughout the driver
> on the probing path.
>
> Signed-off-by: Andrei Stefanescu <andrei.stefanescu at oss.nxp.com>
> Signed-off-by: Khristine Andreea Barbulescu <khristineandreea.barbulescu at oss.nxp.com>
> ---
>  drivers/pinctrl/nxp/pinctrl-s32cc.c | 64 ++++++++++++++---------------
>  1 file changed, 30 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c
> index fe7cd641fddd..56be6e8d624e 100644
> --- a/drivers/pinctrl/nxp/pinctrl-s32cc.c
> +++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c
> @@ -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);
>

Nitpick: I think this is not part of the probe path but is called when
a consumer requests a pin group, so using dev_err_probe is slightly
misleading here, although I think it's harmless.

In any case, with or without that change it looks good to me, so

Reviewed-by: Enric Balletbo i Serra <eballetb at redhat.com>

>         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);
> --
> 2.34.1
>




More information about the linux-arm-kernel mailing list