Skip to contentSkip to conversation

coccinelle: platform_get_irq: Fix parse error

PATCH In review YueHaibing 4 participants 6 messages Sep 6, 2019

Subsystems (2)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 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")
---
 scripts/coccinelle/api/platform_get_irq.cocci | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/coccinelle/api/platform_get_irq.cocci +3 -3
index f6e1afc..06b6a95 100644
@@ -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)
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · YueHaibing

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 )

Quoted 3 lines

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.

Quoted 43 lines
Fixes 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")
---
 scripts/coccinelle/api/platform_get_irq.cocci | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/coccinelle/api/platform_get_irq.cocci +3 -4
index f6e1afc..06b6a95 100644
@@ -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

Reviewed-by on v1 1/1
#2 lore raw
In reply to YueHaibing

Quoting YueHaibing (2019-09-05 20:30:06)

Quoted 13 lines

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 )

Quoted 7 lines

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")

---

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

#3 lore raw
Quoted 9 lines
Quoted 9 lines

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.

Quoted 5 lines
Quoted 3 lines
Fixes 98051ba2b28b ("coccinelle: Add script to check for platform_get_irq() excessive prints")

---

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]/

Quoted 1 line

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

#4 lore raw
Quoted 13 lines · Markus Elfring
Quoted 13 lines
Quoted 12 lines

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")

---

Quoted 5 lines
Quoted 1 line

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.

Quoted 5 lines
Quoted 1 line

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

No.

Quoted 1 line

Will any additional software adjustments be taken into account?

No.

julia

#5 lore raw
Quoted 8 lines
Quoted 3 lines

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.

Quoted 1 line

Please actually test your suggestions before proposing them.

I dare to express also “questionable” development ideas.

Quoted 5 lines
Quoted 3 lines

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

Quoted 3 lines
Quoted 1 line

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