2 /// Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
5 // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
6 // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
7 // URL: http://coccinelle.lip6.fr/
8 // Options: --no-includes --include-headers
10 // Keywords: ERR_PTR, PTR_ERR, PTR_RET, PTR_ERR_OR_ZERO
11 // Version min: 2.6.39
23 - if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
24 + return PTR_ERR_OR_ZERO(ptr);
30 - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
31 + return PTR_ERR_OR_ZERO(ptr);
37 - (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
38 + PTR_ERR_OR_ZERO(ptr)
40 @r1 depends on !patch@
45 * if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
47 @r2 depends on !patch@
52 * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
54 @r3 depends on !patch@
59 * IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0
61 @script:python depends on org@
65 coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
68 @script:python depends on org@
72 coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
74 @script:python depends on org@
78 coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
80 @script:python depends on report@
84 coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
86 @script:python depends on report@
90 coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
92 @script:python depends on report@
96 coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")