Re: [PATCH v2 06/21] pinctrl: equilibrium: Convert to use struct pingroup

Andy Shevchenko
2023-11-24T14:38:55Z

On Fri, Nov 24, 2023 at 09:19:45PM +0800, kernel test robot wrote:

...

> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311241401.ZPILPdov-lkp@intel.com/
>
> smatch warnings:
> drivers/pinctrl/pinctrl-equilibrium.c:719 eqbr_build_groups() warn: unsigned 'grp->npins' is never less than zero.

Thank you for the report!

...

> 718 grp->npins = of_property_count_u32_elems(np, "pins");
> > 719 if (grp->npins < 0) {
> 720 dev_err(dev, "No pins in the group: %s\n", prop->name);
> 721 of_node_put(np);
> 722 return -EINVAL;
> 723 }

Surprisingly (to me) the _count_u32_elems() can return a negative error code...
Fine, I redo a bit the code by introducing a new patch that will use err instead
of ->npins (which sounds better approach anyway).

--
With Best Regards,
Andy Shevchenko