linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2] clk: renesas: fix return value and unused assignment
@ 2021-06-17  2:22 Yang Li
  2021-06-17  7:25 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Li @ 2021-06-17  2:22 UTC (permalink / raw)
  To: geert+renesas
  Cc: mturquette, sboyd, linux-renesas-soc, linux-clk, linux-kernel, Yang Li

Currently the function returns NULL on error, so exact error code is lost.
This patch changes return convention of the function to use ERR_PTR()
on error instead.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---

Change in v2:
--simply "return ERR_PTR(-ENOMEM);"

 drivers/clk/renesas/renesas-rzg2l-cpg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c
index 5009b9e..d46fffd 100644
--- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
+++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
@@ -182,8 +182,7 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw,
 
 	pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL);
 	if (!pll_clk) {
-		clk = ERR_PTR(-ENOMEM);
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 	}
 
 	parent_name = __clk_get_name(parent);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2] clk: renesas: fix return value and unused assignment
  2021-06-17  2:22 [PATCH -next v2] clk: renesas: fix return value and unused assignment Yang Li
@ 2021-06-17  7:25 ` Geert Uytterhoeven
  2021-06-18 11:19   ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-06-17  7:25 UTC (permalink / raw)
  To: Yang Li
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
	Linux Kernel Mailing List

On Thu, Jun 17, 2021 at 4:22 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
> Currently the function returns NULL on error, so exact error code is lost.
> This patch changes return convention of the function to use ERR_PTR()
> on error instead.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-clk-for-v5.15.

> --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
> +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
> @@ -182,8 +182,7 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw,
>
>         pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL);
>         if (!pll_clk) {
> -               clk = ERR_PTR(-ENOMEM);
> -               return NULL;
> +               return ERR_PTR(-ENOMEM);
>         }

I'll drop the curly braces while applying.

>
>         parent_name = __clk_get_name(parent);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2] clk: renesas: fix return value and unused assignment
  2021-06-17  7:25 ` Geert Uytterhoeven
@ 2021-06-18 11:19   ` Geert Uytterhoeven
  2021-06-18 11:40     ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-06-18 11:19 UTC (permalink / raw)
  To: Yang Li
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
	Linux Kernel Mailing List

On Thu, Jun 17, 2021 at 9:25 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Jun 17, 2021 at 4:22 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
> > Currently the function returns NULL on error, so exact error code is lost.
> > This patch changes return convention of the function to use ERR_PTR()
> > on error instead.
> >
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> i.e. will queue in renesas-clk-for-v5.15.
>
> > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
> > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
> > @@ -182,8 +182,7 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw,
> >
> >         pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL);
> >         if (!pll_clk) {
> > -               clk = ERR_PTR(-ENOMEM);
> > -               return NULL;
> > +               return ERR_PTR(-ENOMEM);
> >         }
>
> I'll drop the curly braces while applying.

... and the now unused clk variable.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next v2] clk: renesas: fix return value and unused assignment
  2021-06-18 11:19   ` Geert Uytterhoeven
@ 2021-06-18 11:40     ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-06-18 11:40 UTC (permalink / raw)
  To: Yang Li
  Cc: Michael Turquette, Stephen Boyd, Linux-Renesas, linux-clk,
	Linux Kernel Mailing List

On Fri, Jun 18, 2021 at 1:19 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Thu, Jun 17, 2021 at 9:25 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Thu, Jun 17, 2021 at 4:22 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
> > > Currently the function returns NULL on error, so exact error code is lost.
> > > This patch changes return convention of the function to use ERR_PTR()
> > > on error instead.
> > >
> > > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> >
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > i.e. will queue in renesas-clk-for-v5.15.
> >
> > > --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c
> > > +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c
> > > @@ -182,8 +182,7 @@ static unsigned long rzg2l_cpg_pll_clk_recalc_rate(struct clk_hw *hw,
> > >
> > >         pll_clk = devm_kzalloc(dev, sizeof(*pll_clk), GFP_KERNEL);
> > >         if (!pll_clk) {
> > > -               clk = ERR_PTR(-ENOMEM);
> > > -               return NULL;
> > > +               return ERR_PTR(-ENOMEM);
> > >         }
> >
> > I'll drop the curly braces while applying.
>
> ... and the now unused clk variable.

Oops, that's only after Dan's patch. Reshuffling...

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-18 11:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  2:22 [PATCH -next v2] clk: renesas: fix return value and unused assignment Yang Li
2021-06-17  7:25 ` Geert Uytterhoeven
2021-06-18 11:19   ` Geert Uytterhoeven
2021-06-18 11:40     ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).