blob: 2294915a19bc42c70b1cc2c3d510a7412526036b [file] [log] [blame]
Daniel Granat67afc212015-10-23 17:31:06 +02001/// Make sure (of/i2c/platform)_device_id tables are NULL terminated
Stephen Boyd2d5c5db2014-06-03 20:25:27 +02002//
Daniel Granat67afc212015-10-23 17:31:06 +02003// Keywords: of_table i2c_table platform_table
Stephen Boyd2d5c5db2014-06-03 20:25:27 +02004// Confidence: Medium
5// Options: --include-headers
6
7virtual patch
8virtual context
9virtual org
10virtual report
11
12@depends on context@
13identifier var, arr;
14expression E;
15@@
Daniel Granat67afc212015-10-23 17:31:06 +020016(
17struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
Stephen Boyd2d5c5db2014-06-03 20:25:27 +020018 ...,
19 {
20 .var = E,
21* }
22};
Daniel Granat67afc212015-10-23 17:31:06 +020023|
24struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
25 ...,
26* { ..., E, ... },
27};
28)
Stephen Boyd2d5c5db2014-06-03 20:25:27 +020029
30@depends on patch@
31identifier var, arr;
32expression E;
33@@
Daniel Granat67afc212015-10-23 17:31:06 +020034(
35struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
Stephen Boyd2d5c5db2014-06-03 20:25:27 +020036 ...,
37 {
38 .var = E,
39- }
40+ },
41+ { }
42};
Daniel Granat67afc212015-10-23 17:31:06 +020043|
44struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
45 ...,
46 { ..., E, ... },
47+ { },
48};
49)
Stephen Boyd2d5c5db2014-06-03 20:25:27 +020050
51@r depends on org || report@
52position p1;
53identifier var, arr;
54expression E;
55@@
Daniel Granat67afc212015-10-23 17:31:06 +020056(
57struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
Stephen Boyd2d5c5db2014-06-03 20:25:27 +020058 ...,
59 {
60 .var = E,
61 }
62 @p1
63};
Daniel Granat67afc212015-10-23 17:31:06 +020064|
65struct \(of_device_id \| i2c_device_id \| platform_device_id\) arr[] = {
66 ...,
67 { ..., E, ... }
68 @p1
69};
70)
Stephen Boyd2d5c5db2014-06-03 20:25:27 +020071
72@script:python depends on org@
73p1 << r.p1;
74arr << r.arr;
75@@
76
77cocci.print_main(arr,p1)
78
79@script:python depends on report@
80p1 << r.p1;
81arr << r.arr;
82@@
83
84msg = "%s is not NULL terminated at line %s" % (arr, p1[0].line)
85coccilib.report.print_report(p1[0],msg)