[PATCH -next] clk: npcm7xx: fix return value check in npcm7xx_clk_init()

Julia Lawall julia.lawall at lip6.fr
Wed May 2 20:36:23 AEST 2018



On Wed, 2 May 2018, Tali Perry wrote:

> I added the fix Wei Yongjun indicated ( Thanks Wei !)
> and another fix similar to the above + error print change.
>
> I'm a newbie... what's scripts/coccinelle/ script ?
> I just made a new patch same way I did before. Is this OK?

With Coccinelle, you can make a rule that can be put into the Linux kernel
that can allow others to find this problem automatically. Maybe:

@@
expression e,e1;
statement S1,S2;
@@

e = ioremap(...);
... when != e = e1
if (
-    IS_ERR(e)
+    !e
   )
  S1 else S2

http://coccinelle.lip6.fr/

julia

>
> On Wed, May 2, 2018 at 12:50 AM, Stephen Boyd <sboyd at kernel.org> wrote:
> > Quoting Wei Yongjun (2018-04-26 04:21:08)
> >> In case of error, the function ioremap() returns NULL pointer not
> >> ERR_PTR(). The IS_ERR() test in the return value check should be
> >> replaced with NULL test.
> >>
> >> Fixes: fcfd14369856 ("clk: npcm7xx: add clock controller")
> >> Signed-off-by: Wei Yongjun <weiyongjun1 at huawei.com>
> >
> > Have you made this into a scripts/coccinelle/ script I can run?
> >
> > Applied to clk-next
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


More information about the openbmc mailing list