summaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle/remove_local_err.cocci
blob: 9261c99687a9e60ecbf40f06cdc08bdaf8728aeb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Replace unnecessary usage of local_err variable with
// direct usage of errp argument

@@
identifier F;
expression list ARGS;
expression F2;
identifier LOCAL_ERR;
identifier ERRP;
idexpression V;
typedef Error;
@@
 F(..., Error **ERRP)
 {
     ...
-    Error *LOCAL_ERR;
     ... when != LOCAL_ERR
         when != ERRP
(
-    F2(ARGS, &LOCAL_ERR);
-    error_propagate(ERRP, LOCAL_ERR);
+    F2(ARGS, ERRP);
|
-    V = F2(ARGS, &LOCAL_ERR);
-    error_propagate(ERRP, LOCAL_ERR);
+    V = F2(ARGS, ERRP);
)
     ... when != LOCAL_ERR
 }