aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/api
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-11 21:32:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-11 21:32:29 -0400
commitcbd8aca472134e666eee87462177f1be854ebbf8 (patch)
treefbe0dd2ffbd14eeb1b8ec5dbb39fe52b0cbb76e5 /scripts/coccinelle/api
parent35e9a274fdc9c8feb763e4970a32d7089f51393c (diff)
parent26de9c26bf8557584c1977da92f3ed1b752291cf (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild misc changes from Michal Marek: "In the non-critical part of kbuild, I have - Some make coccicheck improvements and two new tests - Support for a cleaner html output in scripts/kernel-doc, named html5 (no, it does not play videos, yet) BTW, Randy wants to route further kernel-doc patches through the kbuild tree." * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: Update SmPL/Coccinelle section of MAINTAINERS coccicheck: Add the rep+ctxt mode scripts/coccinelle/tests/odd_ptr_err.cocci: semantic patch for IS_ERR/PTR_ERR inconsistency scripts/tags.sh: Add magic for pci access functions scripts/coccinelle: ptr_ret: Add ternary operator version scripts/kernel-doc: drop maintainer scripts/kernel-doc: added support for html5
Diffstat (limited to 'scripts/coccinelle/api')
-rw-r--r--scripts/coccinelle/api/ptr_ret.cocci26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/coccinelle/api/ptr_ret.cocci b/scripts/coccinelle/api/ptr_ret.cocci
index cbfd08c7d8c7..15f076fdecbe 100644
--- a/scripts/coccinelle/api/ptr_ret.cocci
+++ b/scripts/coccinelle/api/ptr_ret.cocci
@@ -30,6 +30,13 @@ expression ptr;
30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 30- if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
31+ return PTR_RET(ptr); 31+ return PTR_RET(ptr);
32 32
33@depends on patch@
34expression ptr;
35@@
36
37- (IS_ERR(ptr) ? PTR_ERR(ptr) : 0)
38+ PTR_RET(ptr)
39
33@r1 depends on !patch@ 40@r1 depends on !patch@
34expression ptr; 41expression ptr;
35position p1; 42position p1;
@@ -44,6 +51,13 @@ position p2;
44 51
45* if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 52* if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0;
46 53
54@r3 depends on !patch@
55expression ptr;
56position p3;
57@@
58
59* IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0
60
47@script:python depends on org@ 61@script:python depends on org@
48p << r1.p1; 62p << r1.p1;
49@@ 63@@
@@ -57,6 +71,12 @@ p << r2.p2;
57 71
58coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") 72coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
59 73
74@script:python depends on org@
75p << r3.p3;
76@@
77
78coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
79
60@script:python depends on report@ 80@script:python depends on report@
61p << r1.p1; 81p << r1.p1;
62@@ 82@@
@@ -68,3 +88,9 @@ p << r2.p2;
68@@ 88@@
69 89
70coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") 90coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
91
92@script:python depends on report@
93p << r3.p3;
94@@
95
96coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")