summaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-01-30 15:07:28 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2014-02-17 11:57:23 -0500
commit84d18f065fb041a1c0d78d20320d740ae0673c8a (patch)
treec43dbfdadc21d4fff0f173f9413396cd314927f9 /qga
parentff9ec34de8f6a37bd29ac72c0c4c94bd5d43d7b0 (diff)
downloadqemu-84d18f065fb041a1c0d78d20320d740ae0673c8a.tar.gz
qemu-84d18f065fb041a1c0d78d20320d740ae0673c8a.tar.bz2
qemu-84d18f065fb041a1c0d78d20320d740ae0673c8a.zip
Use error_is_set() only when necessary
error_is_set(&var) is the same as var != NULL, but it takes whole-program analysis to figure that out. Unnecessarily hard for optimizers, static checkers, and human readers. Dumb it down to obvious. Gets rid of several dozen Coverity false positives. Note that the obvious form is already used in many places. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/commands-posix.c18
-rw-r--r--qga/commands-win32.c2
2 files changed, 10 insertions, 10 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 8100bee67e..cae41716ca 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -108,7 +108,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err)
}
ga_wait_child(pid, &status, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
return;
}
@@ -181,7 +181,7 @@ void qmp_guest_set_time(int64_t time_ns, Error **errp)
}
ga_wait_child(pid, &status, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(errp, local_err);
return;
}
@@ -669,7 +669,7 @@ static void execute_fsfreeze_hook(FsfreezeHookArg arg, Error **err)
}
ga_wait_child(pid, &status, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
return;
}
@@ -713,14 +713,14 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
slog("guest-fsfreeze called");
execute_fsfreeze_hook(FSFREEZE_HOOK_FREEZE, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
return -1;
}
QTAILQ_INIT(&mounts);
build_fs_mount_list(&mounts, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
return -1;
}
@@ -780,7 +780,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err)
QTAILQ_INIT(&mounts);
build_fs_mount_list(&mounts, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
return 0;
}
@@ -861,7 +861,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
QTAILQ_INIT(&mounts);
build_fs_mount_list(&mounts, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
return;
}
@@ -957,7 +957,7 @@ static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg,
}
ga_wait_child(pid, &status, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
goto out;
}
@@ -1034,7 +1034,7 @@ static void guest_suspend(const char *pmutils_bin, const char *sysfile_str,
}
ga_wait_child(pid, &status, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
error_propagate(err, local_err);
goto out;
}
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index a6a0af264b..50094ddfd3 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -197,7 +197,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err)
error:
qmp_guest_fsfreeze_thaw(&local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
g_debug("cleanup thaw: %s", error_get_pretty(local_err));
error_free(local_err);
}