Merge tag 'cocci-for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall...
[linux-block.git] / scripts / coccinelle / misc / minmax.cocci
index fcf908b34f2728371f0cc53f62eb7462ae026519..ca4830ae3042013946665f047ca8d4004b83f888 100644 (file)
@@ -50,11 +50,26 @@ func(...)
        ...>
 }
 
+// Ignore errcode returns.
+@errcode@
+position p;
+identifier func;
+expression x;
+binary operator cmp = {<, <=};
+@@
+
+func(...)
+{
+       <...
+       return ((x) cmp@p 0 ? (x) : 0);
+       ...>
+}
+
 @rmin depends on !patch@
 identifier func;
 expression x, y;
 binary operator cmp = {<, <=};
-position p;
+position p != errcode.p;
 @@
 
 func(...)
@@ -116,21 +131,6 @@ 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;