[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcS7ZZCciAgBH2QU7u8CiHzveAOsvSdv2DQBvpBn_6opQ@mail.gmail.com>
Date: Fri, 22 Oct 2021 15:33:50 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Emil Renner Berthing <kernel@...il.dk>
Cc: linux-riscv <linux-riscv@...ts.infradead.org>,
devicetree <devicetree@...r.kernel.org>,
linux-clk <linux-clk@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Rob Herring <robh+dt@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Marc Zyngier <maz@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Linus Walleij <linus.walleij@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Jiri Slaby <jirislaby@...nel.org>,
Maximilian Luz <luzmaximilian@...il.com>,
Sagar Kadam <sagar.kadam@...ive.com>,
Drew Fustini <drew@...gleboard.org>,
Michael Zhu <michael.zhu@...rfivetech.com>,
Fu Wei <tekkamanninja@...il.com>,
Anup Patel <anup.patel@....com>,
Atish Patra <atish.patra@....com>,
Matteo Croce <mcroce@...rosoft.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 06/16] clk: starfive: Add JH7100 clock generator driver
On Thu, Oct 21, 2021 at 8:43 PM Emil Renner Berthing <kernel@...il.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.
> + 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
Powered by blists - more mailing lists