[Cocci] [RESEND PATCH] coccinelle: misc: minmax: suppress patch generation for err returns

2021-04-27 Thread Denis Efremov
There is a standard idiom for "if 'ret' holds an error, return it":
return ret < 0 ? ret : 0;

Developers prefer to keep the things as they are because stylistic
change to "return min(ret, 0);" breaks readability.

Let's suppress automatic generation for this type of patches.

Signed-off-by: Denis Efremov 
---
 scripts/coccinelle/misc/minmax.cocci | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/scripts/coccinelle/misc/minmax.cocci 
b/scripts/coccinelle/misc/minmax.cocci
index eccdd3eb3452..fcf908b34f27 100644
--- a/scripts/coccinelle/misc/minmax.cocci
+++ b/scripts/coccinelle/misc/minmax.cocci
@@ -116,16 +116,32 @@ func(...)
...>
 }
 
+// Don't generate patches for errcode returns.
+@errcode depends on patch@
+position p;
+identifier func;
+expression x;
+binary operator cmp = {<, <=};
+@@
+
+func(...)
+{
+   <...
+   return ((x) cmp@p 0 ? (x) : 0);
+   ...>
+}
+
 @pmin depends on patch@
 identifier func;
 expression x, y;
 binary operator cmp = {<=, <};
+position p != errcode.p;
 @@
 
 func(...)
 {
<...
--  ((x) cmp (y) ? (x) : (y))
+-  ((x) cmp@p (y) ? (x) : (y))
 +  min(x, y)
...>
 }
-- 
2.30.2

___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH v4] coccinelle: api: semantic patch to use pm_runtime_resume_and_get

2021-04-27 Thread Julia Lawall
pm_runtime_get_sync keeps a reference count on failure, which can lead
to leaks.  pm_runtime_resume_and_get drops the reference count in the
failure case.  This rule very conservatively follows the definition of
pm_runtime_resume_and_get to address the cases where the reference
count is unlikely to be needed in the failure case.  Specifically, the
change is only done when pm_runtime_get_sync is followed immediately
by an if and when the branch of the if is immediately a call to
pm_runtime_put_noidle (like in the definition of
pm_runtime_resume_and_get) or something that is likely a print
statement followed by a pm_runtime_put_noidle call.  The patch
case appears somewhat more complicated, because it also deals with the
cases where {}s need to be removed.

pm_runtime_resume_and_get was introduced in
commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
deal with usage counter")

Signed-off-by: Julia Lawall 
Acked-by: Rafael J. Wysocki 

---
v4: s/pm_runtime_resume_and_get/pm_runtime_put_noidle/ as noted by John Hovold
v3: add the people who signed off on commit dd8088d5a896, expand the log message
v2: better keyword

 scripts/coccinelle/api/pm_runtime_resume_and_get.cocci |  153 +
 1 file changed, 153 insertions(+)

diff --git a/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci 
b/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci
new file mode 100644
index ..3387cb606f9b
--- /dev/null
+++ b/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0-only
+///
+/// Use pm_runtime_resume_and_get.
+/// pm_runtime_get_sync keeps a reference count on failure,
+/// which can lead to leaks.  pm_runtime_resume_and_get
+/// drops the reference count in the failure case.
+/// This rule addresses the cases where the reference count
+/// is unlikely to be needed in the failure case.
+///
+// Confidence: High
+// Copyright: (C) 2021 Julia Lawall, Inria
+// URL: https://coccinelle.gitlabpages.inria.fr/website
+// Options: --include-headers --no-includes
+// Keywords: pm_runtime_get_sync
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+@r0 depends on patch && !context && !org && !report@
+expression ret,e;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+- if (ret < 0)
+- pm_runtime_put_noidle(e);
+
+@r1 depends on patch && !context && !org && !report@
+expression ret,e;
+statement S1,S2;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0)
+- {
+- pm_runtime_put_noidle(e);
+ S1
+- }
+  else S2
+
+@r2 depends on patch && !context && !org && !report@
+expression ret,e;
+statement S;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0) {
+- pm_runtime_put_noidle(e);
+ ...
+  } else S
+
+@r3 depends on patch && !context && !org && !report@
+expression ret,e;
+identifier f;
+constant char[] c;
+statement S;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0)
+- {
+  f(...,c,...);
+- pm_runtime_put_noidle(e);
+- }
+  else S
+
+@r4 depends on patch && !context && !org && !report@
+expression ret,e;
+identifier f;
+constant char[] c;
+statement S;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0) {
+  f(...,c,...);
+- pm_runtime_put_noidle(e);
+ ...
+  } else S
+
+// 
+
+@r2_context depends on !patch && (context || org || report)@
+statement S;
+expression e, ret;
+position j0, j1;
+@@
+
+* ret@j0 = pm_runtime_get_sync(e);
+  if (ret < 0) {
+* pm_runtime_put_noidle@j1(e);
+ ...
+  } else S
+
+@r3_context depends on !patch && (context || org || report)@
+identifier f;
+statement S;
+constant char []c;
+expression e, ret;
+position j0, j1;
+@@
+
+* ret@j0 = pm_runtime_get_sync(e);
+  if (ret < 0) {
+  f(...,c,...);
+* pm_runtime_put_noidle@j1(e);
+ ...
+  } else S
+
+// 
+
+@script:python r2_org depends on org@
+j0 << r2_context.j0;
+j1 << r2_context.j1;
+@@
+
+msg = "WARNING: opportunity for pm_runtime_get_sync"
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+@script:python r3_org depends on org@
+j0 << r3_context.j0;
+j1 << r3_context.j1;
+@@
+
+msg = "WARNING: opportunity for pm_runtime_get_sync"
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+// 
+
+@script:python r2_report depends on report@
+j0 << r2_context.j0;
+j1 << r2_context.j1;
+@@
+
+msg 

Re: [Cocci] [PATCH v3] coccinelle: api: semantic patch to use pm_runtime_resume_and_get

2021-04-27 Thread Rafael J. Wysocki
On Tue, Apr 27, 2021 at 3:51 PM Julia Lawall  wrote:
>
> pm_runtime_get_sync keeps a reference count on failure, which can lead
> to leaks.  pm_runtime_resume_and_get drops the reference count in the
> failure case.  This rule very conservatively follows the definition of
> pm_runtime_resume_and_get to address the cases where the reference
> count is unlikely to be needed in the failure case.  Specifically, the
> change is only done when pm_runtime_get_sync is followed immediately
> by an if and when the branch of the if is immediately a call to
> pm_runtime_put_noidle (like in the definition of
> pm_runtime_resume_and_get) or something that is likely a print
> statement followed by a pm_runtime_resume_and_get call.  The patch
> case appears somewhat more complicated, because it also deals with the
> cases where {}s need to be removed.
>
> pm_runtime_resume_and_get was introduced in
> commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
> deal with usage counter")
>
> Signed-off-by: Julia Lawall 

This patch looks good to me, so

Acked-by: Rafael J. Wysocki 

>
> ---
> v3: add the people who signed off on commit dd8088d5a896, expand the log 
> message
> v2: better keyword
>
>  scripts/coccinelle/api/pm_runtime_resume_and_get.cocci |  153 
> +
>  1 file changed, 153 insertions(+)
>
> diff --git a/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci 
> b/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci
> new file mode 100644
> index ..3387cb606f9b
> --- /dev/null
> +++ b/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci
> @@ -0,0 +1,153 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +///
> +/// Use pm_runtime_resume_and_get.
> +/// pm_runtime_get_sync keeps a reference count on failure,
> +/// which can lead to leaks.  pm_runtime_resume_and_get
> +/// drops the reference count in the failure case.
> +/// This rule addresses the cases where the reference count
> +/// is unlikely to be needed in the failure case.
> +///
> +// Confidence: High
> +// Copyright: (C) 2021 Julia Lawall, Inria
> +// URL: https://coccinelle.gitlabpages.inria.fr/website
> +// Options: --include-headers --no-includes
> +// Keywords: pm_runtime_get_sync
> +
> +virtual patch
> +virtual context
> +virtual org
> +virtual report
> +
> +@r0 depends on patch && !context && !org && !report@
> +expression ret,e;
> +@@
> +
> +- ret = pm_runtime_get_sync(e);
> ++ ret = pm_runtime_resume_and_get(e);
> +- if (ret < 0)
> +- pm_runtime_put_noidle(e);
> +
> +@r1 depends on patch && !context && !org && !report@
> +expression ret,e;
> +statement S1,S2;
> +@@
> +
> +- ret = pm_runtime_get_sync(e);
> ++ ret = pm_runtime_resume_and_get(e);
> +  if (ret < 0)
> +- {
> +- pm_runtime_put_noidle(e);
> + S1
> +- }
> +  else S2
> +
> +@r2 depends on patch && !context && !org && !report@
> +expression ret,e;
> +statement S;
> +@@
> +
> +- ret = pm_runtime_get_sync(e);
> ++ ret = pm_runtime_resume_and_get(e);
> +  if (ret < 0) {
> +- pm_runtime_put_noidle(e);
> + ...
> +  } else S
> +
> +@r3 depends on patch && !context && !org && !report@
> +expression ret,e;
> +identifier f;
> +constant char[] c;
> +statement S;
> +@@
> +
> +- ret = pm_runtime_get_sync(e);
> ++ ret = pm_runtime_resume_and_get(e);
> +  if (ret < 0)
> +- {
> +  f(...,c,...);
> +- pm_runtime_put_noidle(e);
> +- }
> +  else S
> +
> +@r4 depends on patch && !context && !org && !report@
> +expression ret,e;
> +identifier f;
> +constant char[] c;
> +statement S;
> +@@
> +
> +- ret = pm_runtime_get_sync(e);
> ++ ret = pm_runtime_resume_and_get(e);
> +  if (ret < 0) {
> +  f(...,c,...);
> +- pm_runtime_put_noidle(e);
> + ...
> +  } else S
> +
> +// 
> 
> +
> +@r2_context depends on !patch && (context || org || report)@
> +statement S;
> +expression e, ret;
> +position j0, j1;
> +@@
> +
> +* ret@j0 = pm_runtime_get_sync(e);
> +  if (ret < 0) {
> +* pm_runtime_put_noidle@j1(e);
> + ...
> +  } else S
> +
> +@r3_context depends on !patch && (context || org || report)@
> +identifier f;
> +statement S;
> +constant char []c;
> +expression e, ret;
> +position j0, j1;
> +@@
> +
> +* ret@j0 = pm_runtime_get_sync(e);
> +  if (ret < 0) {
> +  f(...,c,...);
> +* pm_runtime_put_noidle@j1(e);
> + ...
> +  } else S
> +
> +// 
> 
> +
> +@script:python r2_org depends on org@
> +j0 << r2_context.j0;
> +j1 << r2_context.j1;
> +@@
> +
> +msg = "WARNING: opportunity for pm_runtime_get_sync"
> +coccilib.org.print_todo(j0[0], msg)
> +coccilib.org.print_link(j1[0], "")
> +
> +@script:python r3_org depends on org@
> +j0 << r3_context.

Re: [Cocci] [PATCH v2] coccinelle: api: semantic patch to use pm_runtime_resume_and_get

2021-04-27 Thread Rafael J. Wysocki
On Tue, Apr 27, 2021 at 3:18 PM Johan Hovold  wrote:
>
> On Mon, Apr 26, 2021 at 08:54:04PM +0200, Julia Lawall wrote:
> > pm_runtime_get_sync keeps a reference count on failure, which can lead
> > to leaks.  pm_runtime_resume_and_get drops the reference count in the
> > failure case.  This rule very conservatively follows the definition of
> > pm_runtime_resume_and_get to address the cases where the reference
> > count is unlikely to be needed in the failure case.
> >
> > pm_runtime_resume_and_get was introduced in
> > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
> > deal with usage counter")
> >
> > Signed-off-by: Julia Lawall 
>
> As I've said elsewhere, not sure trying to do a mass conversion of this
> is a good idea.

No, it isn't.

> People may not be used to the interface, but it is
> consistent and has its use. The recent flurry of conversions show that
> those also risk introducing new bugs in code that is currently tested
> and correct.
>
> By giving the script kiddies another toy like this, the influx of broken
> patches is just bound to increase.
>
> Would also be good to CC the PM maintainer on this issue.

There are many call sites in the kernel where replacing
pm_runtime_get_sync() with pm_runtime_resume_and_get() mechanically
would introduce an error, so please don't do that.

Every such replacement should be reviewed by the people familiar with
the code in question.

Thanks,
Rafael
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH v2] coccinelle: api: semantic patch to use pm_runtime_resume_and_get

2021-04-27 Thread Johan Hovold
On Mon, Apr 26, 2021 at 08:54:04PM +0200, Julia Lawall wrote:
> pm_runtime_get_sync keeps a reference count on failure, which can lead
> to leaks.  pm_runtime_resume_and_get drops the reference count in the
> failure case.  This rule very conservatively follows the definition of
> pm_runtime_resume_and_get to address the cases where the reference
> count is unlikely to be needed in the failure case.
> 
> pm_runtime_resume_and_get was introduced in
> commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
> deal with usage counter")
> 
> Signed-off-by: Julia Lawall 

As I've said elsewhere, not sure trying to do a mass conversion of this
is a good idea. People may not be used to the interface, but it is
consistent and has its use. The recent flurry of conversions show that
those also risk introducing new bugs in code that is currently tested
and correct.

By giving the script kiddies another toy like this, the influx of broken
patches is just bound to increase.

Would also be good to CC the PM maintainer on this issue.

Johan
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH v3] coccinelle: api: semantic patch to use pm_runtime_resume_and_get

2021-04-27 Thread Julia Lawall
pm_runtime_get_sync keeps a reference count on failure, which can lead
to leaks.  pm_runtime_resume_and_get drops the reference count in the
failure case.  This rule very conservatively follows the definition of
pm_runtime_resume_and_get to address the cases where the reference
count is unlikely to be needed in the failure case.  Specifically, the
change is only done when pm_runtime_get_sync is followed immediately
by an if and when the branch of the if is immediately a call to
pm_runtime_put_noidle (like in the definition of
pm_runtime_resume_and_get) or something that is likely a print
statement followed by a pm_runtime_resume_and_get call.  The patch
case appears somewhat more complicated, because it also deals with the
cases where {}s need to be removed.

pm_runtime_resume_and_get was introduced in
commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
deal with usage counter")

Signed-off-by: Julia Lawall 

---
v3: add the people who signed off on commit dd8088d5a896, expand the log message
v2: better keyword

 scripts/coccinelle/api/pm_runtime_resume_and_get.cocci |  153 +
 1 file changed, 153 insertions(+)

diff --git a/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci 
b/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci
new file mode 100644
index ..3387cb606f9b
--- /dev/null
+++ b/scripts/coccinelle/api/pm_runtime_resume_and_get.cocci
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0-only
+///
+/// Use pm_runtime_resume_and_get.
+/// pm_runtime_get_sync keeps a reference count on failure,
+/// which can lead to leaks.  pm_runtime_resume_and_get
+/// drops the reference count in the failure case.
+/// This rule addresses the cases where the reference count
+/// is unlikely to be needed in the failure case.
+///
+// Confidence: High
+// Copyright: (C) 2021 Julia Lawall, Inria
+// URL: https://coccinelle.gitlabpages.inria.fr/website
+// Options: --include-headers --no-includes
+// Keywords: pm_runtime_get_sync
+
+virtual patch
+virtual context
+virtual org
+virtual report
+
+@r0 depends on patch && !context && !org && !report@
+expression ret,e;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+- if (ret < 0)
+- pm_runtime_put_noidle(e);
+
+@r1 depends on patch && !context && !org && !report@
+expression ret,e;
+statement S1,S2;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0)
+- {
+- pm_runtime_put_noidle(e);
+ S1
+- }
+  else S2
+
+@r2 depends on patch && !context && !org && !report@
+expression ret,e;
+statement S;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0) {
+- pm_runtime_put_noidle(e);
+ ...
+  } else S
+
+@r3 depends on patch && !context && !org && !report@
+expression ret,e;
+identifier f;
+constant char[] c;
+statement S;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0)
+- {
+  f(...,c,...);
+- pm_runtime_put_noidle(e);
+- }
+  else S
+
+@r4 depends on patch && !context && !org && !report@
+expression ret,e;
+identifier f;
+constant char[] c;
+statement S;
+@@
+
+- ret = pm_runtime_get_sync(e);
++ ret = pm_runtime_resume_and_get(e);
+  if (ret < 0) {
+  f(...,c,...);
+- pm_runtime_put_noidle(e);
+ ...
+  } else S
+
+// 
+
+@r2_context depends on !patch && (context || org || report)@
+statement S;
+expression e, ret;
+position j0, j1;
+@@
+
+* ret@j0 = pm_runtime_get_sync(e);
+  if (ret < 0) {
+* pm_runtime_put_noidle@j1(e);
+ ...
+  } else S
+
+@r3_context depends on !patch && (context || org || report)@
+identifier f;
+statement S;
+constant char []c;
+expression e, ret;
+position j0, j1;
+@@
+
+* ret@j0 = pm_runtime_get_sync(e);
+  if (ret < 0) {
+  f(...,c,...);
+* pm_runtime_put_noidle@j1(e);
+ ...
+  } else S
+
+// 
+
+@script:python r2_org depends on org@
+j0 << r2_context.j0;
+j1 << r2_context.j1;
+@@
+
+msg = "WARNING: opportunity for pm_runtime_get_sync"
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+@script:python r3_org depends on org@
+j0 << r3_context.j0;
+j1 << r3_context.j1;
+@@
+
+msg = "WARNING: opportunity for pm_runtime_get_sync"
+coccilib.org.print_todo(j0[0], msg)
+coccilib.org.print_link(j1[0], "")
+
+// 
+
+@script:python r2_report depends on report@
+j0 << r2_context.j0;
+j1 << r2_context.j1;
+@@
+
+msg = "WARNING: opportunity for pm_runtime_get_sync on line %s." % (j0[0].line)
+coccilib.report.print_repor

Re: [Cocci] [PATCH v2] coccinelle: api: semantic patch to use pm_runtime_resume_and_get

2021-04-27 Thread Julia Lawall



On Tue, 27 Apr 2021, Johan Hovold wrote:

> On Mon, Apr 26, 2021 at 08:54:04PM +0200, Julia Lawall wrote:
> > pm_runtime_get_sync keeps a reference count on failure, which can lead
> > to leaks.  pm_runtime_resume_and_get drops the reference count in the
> > failure case.  This rule very conservatively follows the definition of
> > pm_runtime_resume_and_get to address the cases where the reference
> > count is unlikely to be needed in the failure case.
> >
> > pm_runtime_resume_and_get was introduced in
> > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to
> > deal with usage counter")
> >
> > Signed-off-by: Julia Lawall 
>
> As I've said elsewhere, not sure trying to do a mass conversion of this
> is a good idea. People may not be used to the interface, but it is
> consistent and has its use. The recent flurry of conversions show that
> those also risk introducing new bugs in code that is currently tested
> and correct.

I looked some of the patches you commented on, and this rule would not
have transformed those cases.  This rule is very restricted to ensure that
the transformed code follows the behavior of the new function.

>
> By giving the script kiddies another toy like this, the influx of broken
> patches is just bound to increase.
>
> Would also be good to CC the PM maintainer on this issue.

Sure, I can resend with Rafael in CC.

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH v2] scripts: coccicheck: Fix chain mode in coccicheck

2021-04-27 Thread Davidson Francis
On Sat, Mar 06, 2021 at 05:05:41PM -0300, Davidson Francis wrote:
> As described in the Coccinelle documentation (Documentation/dev-tools/
> coccinelle.rst), chain mode should try patch, report, context, and org
> modes until one of them succeed.
> 
> It turns out that currently, the 'run_cmd_parmap' function, by failing
> to run $SPATCH, rather than returning an error code, kills the execution
> of the script by executing the exit command, rather than returning the
> error code.
> 
> This way, when running coccicheck in chain mode, as in:
> $ make coccicheck MODE=chain
> 
> the first .cocci file that does not support one of the virtual rules
> stops the execution of the makefile, rather than trying the remaining
> rules as specified in the documentation.
> 
> Therefore, modify the coccicheck script to return the error code,
> rather than terminating the script. When returning the error code,
> it returns the same value obtained in run_cmd, instead of the
> generic value '1'.
> 
> Signed-off-by: Davidson Francis 
> ---
> Changes in v2:
> * Use the same return value from run_cmd as the exit value
> 
>  scripts/coccicheck | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 65fee63aeadb..165701657c5a 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -153,7 +153,7 @@ run_cmd_parmap() {
>   err=$?
>   if [[ $err -ne 0 ]]; then
>   echo "coccicheck failed"
> - exit $err
> + return $err
>   fi
>  }
>  
> @@ -251,14 +251,14 @@ coccinelle () {
>   run_cmd $SPATCH -D context \
>   $FLAGS --cocci-file $COCCI $OPT $OPTIONS   || \
>   run_cmd $SPATCH -D org \
> - $FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff || exit 
> 1
> + $FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff || exit 
> $?
>  elif [ "$MODE" = "rep+ctxt" ] ; then
>   run_cmd $SPATCH -D report  \
>   $FLAGS --cocci-file $COCCI $OPT $OPTIONS --no-show-diff && \
>   run_cmd $SPATCH -D context \
> - $FLAGS --cocci-file $COCCI $OPT $OPTIONS || exit 1
> + $FLAGS --cocci-file $COCCI $OPT $OPTIONS || exit $?
>  else
> - run_cmd $SPATCH -D $MODE   $FLAGS --cocci-file $COCCI $OPT $OPTIONS || 
> exit 1
> + run_cmd $SPATCH -D $MODE   $FLAGS --cocci-file $COCCI $OPT $OPTIONS || 
> exit $?
>  fi
>  
>  }
> -- 
> 2.29.1
> 

Ping for review.

Regards,
Davidson Francis.

___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci