Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20190701' into staging
[qemu/ar7.git] / scripts / coccinelle / remove_local_err.cocci
blob9261c99687a9e60ecbf40f06cdc08bdaf8728aeb
1 // Replace unnecessary usage of local_err variable with
2 // direct usage of errp argument
4 @@
5 identifier F;
6 expression list ARGS;
7 expression F2;
8 identifier LOCAL_ERR;
9 identifier ERRP;
10 idexpression V;
11 typedef Error;
13  F(..., Error **ERRP)
14  {
15      ...
16 -    Error *LOCAL_ERR;
17      ... when != LOCAL_ERR
18          when != ERRP
20 -    F2(ARGS, &LOCAL_ERR);
21 -    error_propagate(ERRP, LOCAL_ERR);
22 +    F2(ARGS, ERRP);
24 -    V = F2(ARGS, &LOCAL_ERR);
25 -    error_propagate(ERRP, LOCAL_ERR);
26 +    V = F2(ARGS, ERRP);
28      ... when != LOCAL_ERR
29  }