diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2016-06-20 16:19:18 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2016-06-20 16:19:18 +0100 |
commit | 7fa124b273acd22a808e742ead78c065ccd9b4c4 (patch) | |
tree | 60fc0c2deebaa7cef45b35f123986eed40f3ba3f /scripts | |
parent | fd2590bccc0bd63833813592a3e193686cf1c623 (diff) | |
parent | daa76aa416b1e18ab1fac650ff53d966d8f21f68 (diff) | |
download | qemu-7fa124b273acd22a808e742ead78c065ccd9b4c4.zip qemu-7fa124b273acd22a808e742ead78c065ccd9b4c4.tar.gz qemu-7fa124b273acd22a808e742ead78c065ccd9b4c4.tar.bz2 |
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-06-20' into staging
Error reporting patches for 2016-06-20
# gpg: Signature made Mon 20 Jun 2016 15:56:15 BST
# gpg: using RSA key 0x3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>"
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-error-2016-06-20:
log: Fix qemu_set_log_filename() error handling
log: Fix qemu_set_dfilter_ranges() error reporting
log: Plug memory leak on multiple -dfilter
coccinelle: Remove unnecessary variables for function return value
error: Remove unnecessary local_err variables
error: Remove NULL checks on error_propagate() calls
vl: Error messages need to go to stderr, fix some
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/error_propagate_null.cocci | 10 | ||||
-rw-r--r-- | scripts/coccinelle/remove_local_err.cocci | 29 | ||||
-rw-r--r-- | scripts/coccinelle/return_directly.cocci | 19 |
3 files changed, 58 insertions, 0 deletions
diff --git a/scripts/coccinelle/error_propagate_null.cocci b/scripts/coccinelle/error_propagate_null.cocci new file mode 100644 index 0000000..c236380 --- /dev/null +++ b/scripts/coccinelle/error_propagate_null.cocci @@ -0,0 +1,10 @@ +// error_propagate() already ignores local_err==NULL, so there's +// no need to check it before calling. + +@@ +identifier L; +expression E; +@@ +-if (L) { + error_propagate(E, L); +-} diff --git a/scripts/coccinelle/remove_local_err.cocci b/scripts/coccinelle/remove_local_err.cocci new file mode 100644 index 0000000..9261c99 --- /dev/null +++ b/scripts/coccinelle/remove_local_err.cocci @@ -0,0 +1,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 + } diff --git a/scripts/coccinelle/return_directly.cocci b/scripts/coccinelle/return_directly.cocci new file mode 100644 index 0000000..48680f2 --- /dev/null +++ b/scripts/coccinelle/return_directly.cocci @@ -0,0 +1,19 @@ +// replace 'R = X; return R;' with 'return R;' +@@ +identifier VAR; +expression E; +type T; +identifier F; +@@ + T F(...) + { + ... +- T VAR; + ... when != VAR + +- VAR = ++ return + E; +- return VAR; + ... when != VAR + } |