2019-09-06 10:34:28

by Yue Haibing

[permalink] [raw]
Subject: [PATCH -next] coccinelle: platform_get_irq: Fix parse error

When do coccicheck, I get this error:

spatch -D report --no-show-diff --very-quiet --cocci-file
./scripts/coccinelle/api/platform_get_irq.cocci --include-headers
--dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
-I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
-I ./include/uapi -I ./include/generated/uapi
--include ./include/linux/kconfig.h --jobs 192 --chunksize 1
minus: parse error:
File "./scripts/coccinelle/api/platform_get_irq.cocci", line 24, column 9, charpos = 355
around = '\(',
whole content = if ( ret \( < \| <= \) 0 )

In commit e56476897448 ("fpga: Remove dev_err() usage
after platform_get_irq()") log, I found the semantic patch,
it fix this issue.

Fixes: 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")
Signed-off-by: YueHaibing <[email protected]>
---
scripts/coccinelle/api/platform_get_irq.cocci | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/coccinelle/api/platform_get_irq.cocci b/scripts/coccinelle/api/platform_get_irq.cocci
index f6e1afc..06b6a95 100644
--- a/scripts/coccinelle/api/platform_get_irq.cocci
+++ b/scripts/coccinelle/api/platform_get_irq.cocci
@@ -21,7 +21,7 @@ platform_get_irq
platform_get_irq_byname
)(E, ...);

-if ( ret \( < \| <= \) 0 )
+if ( \( ret < 0 \| ret <= 0 \) )
{
(
if (ret != -EPROBE_DEFER)
@@ -47,7 +47,7 @@ platform_get_irq
platform_get_irq_byname
)(E, ...);

-if ( ret \( < \| <= \) 0 )
+if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
@@ -74,7 +74,7 @@ platform_get_irq
platform_get_irq_byname
)(E, ...);

-if ( ret \( < \| <= \) 0 )
+if ( \( ret < 0 \| ret <= 0 \) )
{
(
if (ret != -EPROBE_DEFER)
--
2.7.4



2019-09-06 10:36:15

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH -next] coccinelle: platform_get_irq: Fix parse error



On Fri, 6 Sep 2019, YueHaibing wrote:

> When do coccicheck, I get this error:
>
> spatch -D report --no-show-diff --very-quiet --cocci-file
> ./scripts/coccinelle/api/platform_get_irq.cocci --include-headers
> --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 192 --chunksize 1
> minus: parse error:
> File "./scripts/coccinelle/api/platform_get_irq.cocci", line 24, column 9, charpos = 355
> around = '\(',
> whole content = if ( ret \( < \| <= \) 0 )
>
> In commit e56476897448 ("fpga: Remove dev_err() usage
> after platform_get_irq()") log, I found the semantic patch,
> it fix this issue.

Thanks very much for reporting the problem.

Acked-by: Julia Lawall <[email protected]>


>
> Fixes: 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")
> Signed-off-by: YueHaibing <[email protected]>
> ---
> scripts/coccinelle/api/platform_get_irq.cocci | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/coccinelle/api/platform_get_irq.cocci b/scripts/coccinelle/api/platform_get_irq.cocci
> index f6e1afc..06b6a95 100644
> --- a/scripts/coccinelle/api/platform_get_irq.cocci
> +++ b/scripts/coccinelle/api/platform_get_irq.cocci
> @@ -21,7 +21,7 @@ platform_get_irq
> platform_get_irq_byname
> )(E, ...);
>
> -if ( ret \( < \| <= \) 0 )
> +if ( \( ret < 0 \| ret <= 0 \) )
> {
> (
> if (ret != -EPROBE_DEFER)
> @@ -47,7 +47,7 @@ platform_get_irq
> platform_get_irq_byname
> )(E, ...);
>
> -if ( ret \( < \| <= \) 0 )
> +if ( \( ret < 0 \| ret <= 0 \) )
> {
> (
> -if (ret != -EPROBE_DEFER)
> @@ -74,7 +74,7 @@ platform_get_irq
> platform_get_irq_byname
> )(E, ...);
>
> -if ( ret \( < \| <= \) 0 )
> +if ( \( ret < 0 \| ret <= 0 \) )
> {
> (
> if (ret != -EPROBE_DEFER)
> --
> 2.7.4
>
>
>

2019-09-06 10:38:26

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH -next] coccinelle: platform_get_irq: Fix parse error

Quoting YueHaibing (2019-09-05 20:30:06)
> When do coccicheck, I get this error:
>
> spatch -D report --no-show-diff --very-quiet --cocci-file
> ./scripts/coccinelle/api/platform_get_irq.cocci --include-headers
> --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include
> -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi
> -I ./include/uapi -I ./include/generated/uapi
> --include ./include/linux/kconfig.h --jobs 192 --chunksize 1
> minus: parse error:
> File "./scripts/coccinelle/api/platform_get_irq.cocci", line 24, column 9, charpos = 355
> around = '\(',
> whole content = if ( ret \( < \| <= \) 0 )
>
> In commit e56476897448 ("fpga: Remove dev_err() usage
> after platform_get_irq()") log, I found the semantic patch,
> it fix this issue.
>
> Fixes: 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")
> Signed-off-by: YueHaibing <[email protected]>
> ---

Hmm I had this earlier but someone asked me to change it.

Reviewed-by: Stephen Boyd <[email protected]>

2019-09-06 13:02:57

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH -next] coccinelle: platform_get_irq: Fix parse error



On Fri, 6 Sep 2019, Markus Elfring wrote:

> > > minus: parse error:
> > > File "./scripts/coccinelle/api/platform_get_irq.cocci", line 24, column 9, charpos = 355
> > > around = '\(',
> > > whole content = if ( ret \( < \| <= \) 0 )
> > >
> > > In commit e56476897448 ("fpga: Remove dev_err() usage
> > > after platform_get_irq()") log, I found the semantic patch,
> > > it fix this issue.
> > >
> > > Fixes: 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")
> > > Signed-off-by: YueHaibing <[email protected]>
> > > ---
> >
> > Hmm I had this earlier but someone asked me to change it.
>
> I proposed something also during the development for this SmPL script.
> https://lkml.org/lkml/2019/7/24/274
> https://lore.kernel.org/r/[email protected]/

Markus,

This is not the first time you have suggested to someone to do something
that was simply incorrect. Please actually test your suggestions before
proposing them.

> > Reviewed-by: Stephen Boyd <[email protected]>
>
> Should disjunctions eventually work in the semantic patch language also together with
> comparison operators?
> https://github.com/coccinelle/coccinelle/issues/40

No.

> Will any additional software adjustments be taken into account?

No.

julia

2019-09-06 13:15:06

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH -next] coccinelle: platform_get_irq: Fix parse error

>> I proposed something also during the development for this SmPL script.
>> https://lkml.org/lkml/2019/7/24/274
>> https://lore.kernel.org/r/[email protected]/
>
> Markus,
>
> This is not the first time you have suggested to someone to do something
> that was simply incorrect.

We come along different application expectations.


> Please actually test your suggestions before proposing them.

I dare to express also “questionable” development ideas.


>> Should disjunctions eventually work in the semantic patch language also together with
>> comparison operators?
>> https://github.com/coccinelle/coccinelle/issues/40
>
> No.

Can a similar effect be achieved by using a SmPL constraint for
a metavariable of the type “binary operator”?
https://github.com/coccinelle/coccinelle/blob/b4509f6e7fb06d5616bb19dd5a110b203fd0e566/docs/manual/cocci_syntax.tex#L266


>> Will any additional software adjustments be taken into account?
>
> No.

I imagine that this view can change over time according to remaining feature requests.

Regards,
Markus

2019-09-06 13:41:29

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH -next] coccinelle: platform_get_irq: Fix parse error

> > minus: parse error:
> > File "./scripts/coccinelle/api/platform_get_irq.cocci", line 24, column 9, charpos = 355
> > around = '\(',
> > whole content = if ( ret \( < \| <= \) 0 )
> >
> > In commit e56476897448 ("fpga: Remove dev_err() usage
> > after platform_get_irq()") log, I found the semantic patch,
> > it fix this issue.
> >
> > Fixes: 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")
> > Signed-off-by: YueHaibing <[email protected]>
> > ---
>
> Hmm I had this earlier but someone asked me to change it.

I proposed something also during the development for this SmPL script.
https://lkml.org/lkml/2019/7/24/274
https://lore.kernel.org/r/[email protected]/


> Reviewed-by: Stephen Boyd <[email protected]>

Should disjunctions eventually work in the semantic patch language also together with
comparison operators?
https://github.com/coccinelle/coccinelle/issues/40


Will any additional software adjustments be taken into account?

Regards,
Markus