2 /// Use PTR_RET 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
11 // Version min: 2.6.39
23 - if (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
24 + return PTR_RET(ptr);
30 - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
31 + return PTR_RET(ptr);
33 @r1 depends on !patch@
38 * if@p1 (IS_ERR(ptr)) return PTR_ERR(ptr); else return 0;
40 @r2 depends on !patch@
45 * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
47 @script:python depends on org@
51 coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
54 @script:python depends on org@
58 coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
60 @script:python depends on report@
64 coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
66 @script:python depends on report@
70 coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")