lkml.org 
[lkml]   [2021]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 06/16] clk: starfive: Add JH7100 clock generator driver
On Fri, 22 Oct 2021 at 14:34, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Thu, Oct 21, 2021 at 8:43 PM Emil Renner Berthing <kernel@esmil.dk> wrote:
>
> ...
>
> > +static struct clk_hw *clk_starfive_jh7100_get(struct of_phandle_args *clkspec, void *data)
> > +{
> > + struct clk_starfive_jh7100_priv *priv = data;
> > + unsigned int idx = clkspec->args[0];
> > +
> > + if (idx >= JH7100_CLK_END) {
> > + dev_err(priv->dev, "invalid clock index %u\n", idx);
> > + return ERR_PTR(-EINVAL);
>
> After this
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git/commit/?h=driver-core-next&id=7065f92255bb2468dbb9aa0537ff186ef64d5a02
> It's okay to use
>
> > + }
>
> if (idx >= JH7100_CLK_END)
> return dev_err_probe(priv->dev, -EINVAL, "invalid clock
> index %u\n", idx);
>
> Ditto for other similar cases.

Hmm.. this function doesn't return int, but struct clk_hw *, hence the ERR_PTR.
Also I don't see any other similar cases in this driver.

> > + if (idx >= JH7100_CLK_PLL0_OUT)
> > + return priv->pll[idx - JH7100_CLK_PLL0_OUT];
> > +
> > + return &priv->reg[idx].hw;
> > +}
>
> ...
>
> > + while (idx)
> > + clk_hw_unregister(&priv->reg[--idx].hw);
>
> I still consider that usual pattern, i.e.
>
> while (idx--)
> clk_hw_unregister(&priv->reg[idx].hw);
>
> but since you are pushing hard for your variant I'll leave it to the
> maintainers and author.
>
> --
> With Best Regards,
> Andy Shevchenko

\
 
 \ /
  Last update: 2021-10-22 15:14    [W:0.576 / U:1.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site