Re: [PATCH v1 14/19] pinctrl: st: Use temporary variable for struct device

From: Joe Perches
Date: Sat Nov 06 2021 - 04:28:47 EST


On Sat, 2021-11-06 at 10:07 +0200, Andy Shevchenko wrote:
> On Saturday, November 6, 2021, Joe Perches <joe@xxxxxxxxxxx> wrote:
> > On Fri, 2021-11-05 at 14:42 +0200, Andy Shevchenko wrote:
> > > Use temporary variable for struct device to make code neater.
> > []
> > > diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
> > []
> > > @@ -814,26 +814,25 @@ static int st_pctl_dt_node_to_map(struct
> > pinctrl_dev *pctldev,
> > > {
> > > struct st_pinctrl *info = pinctrl_dev_get_drvdata(pctldev);
> > > const struct st_pctl_group *grp;
> > > + struct device *dev = info->dev;
> > []
> > > - new_map = devm_kcalloc(pctldev->dev,
> > > - map_num, sizeof(*new_map), GFP_KERNEL);
> > > + new_map = devm_kcalloc(dev, map_num, sizeof(*new_map), GFP_KERNEL);
> >
> > Are pctldev->dev and dev the same pointer?
>
> Seems so.

OK.

> https://elixir.bootlin.com/linux/latest/source/drivers/pinctrl/core.c#L2015
>
> > It seems they are not.
>
> Can you elaborate, please?

>From code shape, you assign dev to info->dev rather than pctldev->dev

I also believe this single 19 patch series would be better as
multiple patch series.

IMO: the strarray variants introduction and use should be a separate
patchset from the rest.