1 // SPDX-License-Identifier: GPL-2.0-only
2 /// PTR_ERR should access the value just tested by IS_ERR
3 //# There can be false positives in the patch case, where it is the call to
4 //# IS_ERR that is wrong.
7 // Copyright: (C) 2012, 2015 Julia Lawall, INRIA.
8 // Copyright: (C) 2012, 2015 Gilles Muller, INRIA.
9 // URL: http://coccinelle.lip6.fr/
10 // Options: --no-includes --include-headers
22 if (IS_ERR(x=e) || ...) {
33 if (IS_ERR(x) || ...) {
36 PTR_ERR@p(\(e1 ? e2 : x\|e1 ? x : e2\))
43 @r1 depends on patch && !context && !org && !report exists@
45 position p != {ok1.p,ok2.p};
48 if (IS_ERR(x) || ...) {
62 // ----------------------------------------------------------------------------
64 @r1_context depends on !patch && (context || org || report) exists@
65 position p != {ok1.p,ok2.p};
70 if (IS_ERR@j0(x) || ...) {
83 @r1_disj depends on !patch && (context || org || report) exists@
84 position p != {ok1.p,ok2.p};
86 position r1_context.j0, r1_context.j1;
89 * if (IS_ERR@j0(x) || ...) {
98 // ----------------------------------------------------------------------------
100 @script:python r1_org depends on org@
105 msg = "inconsistent IS_ERR and PTR_ERR"
106 coccilib.org.print_todo(j0[0], msg)
107 coccilib.org.print_link(j1[0], "")
109 // ----------------------------------------------------------------------------
111 @script:python r1_report depends on report@
116 msg = "inconsistent IS_ERR and PTR_ERR on line %s." % (j1[0].line)
117 coccilib.report.print_report(j0[0], msg)