GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / scripts / coccinelle / alloc / drop_kmalloc_cast.cocci
blob7d4771d449c3491e24ed9ff701a56e6991c108ac
1 ///
2 /// Casting (void *) value returned by kmalloc is useless
3 /// as mentioned in Documentation/CodingStyle, Chap 14.
4 ///
5 // Confidence: High
6 // Copyright: 2009,2010 Nicolas Palix, DIKU.  GPLv2.
7 // URL: http://coccinelle.lip6.fr/
8 // Options: -no_includes -include_headers
9 //
10 // Keywords: kmalloc, kzalloc, kcalloc
11 // Version min: < 2.6.12 kmalloc
12 // Version min: < 2.6.12 kcalloc
13 // Version min:   2.6.14 kzalloc
16 virtual context
17 virtual patch
18 virtual org
19 virtual report
21 //----------------------------------------------------------
22 //  For context mode
23 //----------------------------------------------------------
25 @depends on context@
26 type T;
29 * (T *)
30   \(kmalloc\|kzalloc\|kcalloc\)(...)
32 //----------------------------------------------------------
33 //  For patch mode
34 //----------------------------------------------------------
36 @depends on patch@
37 type T;
40 - (T *)
41   \(kmalloc\|kzalloc\|kcalloc\)(...)
43 //----------------------------------------------------------
44 //  For org and report mode
45 //----------------------------------------------------------
47 @r depends on org || report@
48 type T;
49 position p;
52  (T@p *)\(kmalloc\|kzalloc\|kcalloc\)(...)
54 @script:python depends on org@
55 p << r.p;
56 t << r.T;
59 coccilib.org.print_safe_todo(p[0], t)
61 @script:python depends on report@
62 p << r.p;
63 t << r.T;
66 msg="WARNING: casting value returned by k[cmz]alloc to (%s *) is useless." % (t)
67 coccilib.report.print_report(p[0], msg)