History

Coccinelle: pm_runtime: ensure relevance of pm_runtime reports

pm_runtime.cocci starts with one rule that searches for a variety of functions calls, followed by various rules that report errors. Previously, the only connection between the first rule and the rest was to check that the first rule had matched somewhere. Change the rules to propagate a position from the first rule to the others, to make sure that the sites reported on are the same as the sites that were identified as having the relevant functions.

Julia Lawall committed 10 years ago

Commit d97629f1 parent 43d96391 file · +11 −7Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/coccinelle/api/pm_runtime.cocci+11−7
@@ -17,9 +17,10 @@ virtual report · 16 unmodified lines
1717
1818 @runtime_bad_err_handle exists@
1919 expression ret;
20+position p;
2021 @@
2122 (
22−ret = \(pm_runtime_idle\|
23+ret@p = \(pm_runtime_idle\|
2324 pm_runtime_suspend\|
2425 pm_runtime_autosuspend\|
2526 pm_runtime_resume\|
@@ -47,12 +48,13 @@ IS_ERR_VALUE(ret) · 21 unmodified lines
4748 // For context mode
4849 //----------------------------------------------------------
4950
50−@depends on runtime_bad_err_handle && context@
51+@depends on context@
5152 identifier pm_runtime_api;
5253 expression ret;
54+position runtime_bad_err_handle.p;
5355 @@
5456 (
55−ret = pm_runtime_api(...);
57+ret@p = pm_runtime_api(...);
5658 ...
5759 * IS_ERR_VALUE(ret)
5860 ...
@@ -62,12 +64,13 @@ ret = pm_runtime_api(...); · 3 unmodified lines
6264 // For patch mode
6365 //----------------------------------------------------------
6466
65−@depends on runtime_bad_err_handle && patch@
67+@depends on patch@
6668 identifier pm_runtime_api;
6769 expression ret;
70+position runtime_bad_err_handle.p;
6871 @@
6972 (
70−ret = pm_runtime_api(...);
73+ret@p = pm_runtime_api(...);
7174 ...
7275 - IS_ERR_VALUE(ret)
7376 + ret < 0
@@ -78,13 +81,14 @@ ret = pm_runtime_api(...); · 4 unmodified lines
7881 // For org and report mode
7982 //----------------------------------------------------------
8083
81−@r depends on runtime_bad_err_handle && (org || report) exists@
84+@r depends on (org || report) exists@
8285 position p1, p2;
8386 identifier pm_runtime_api;
8487 expression ret;
88+position runtime_bad_err_handle.p;
8589 @@
8690 (
87−ret = pm_runtime_api@p1(...);
91+ret@p = pm_runtime_api@p1(...);
8892 ...
8993 IS_ERR_VALUE@p2(ret)
9094 ...

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t