aboutsummaryrefslogtreecommitdiff
path: root/hw
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 /hw
parentff9ec34de8f6a37bd29ac72c0c4c94bd5d43d7b0 (diff)
downloadqemu-84d18f065fb041a1c0d78d20320d740ae0673c8a.zip
qemu-84d18f065fb041a1c0d78d20320d740ae0673c8a.tar.gz
qemu-84d18f065fb041a1c0d78d20320d740ae0673c8a.tar.bz2
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 'hw')
-rw-r--r--hw/pci/pci-hotplug-old.c4
-rw-r--r--hw/usb/dev-network.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c
index 8dbc3c1..cf2caeb 100644
--- a/hw/pci/pci-hotplug-old.c
+++ b/hw/pci/pci-hotplug-old.c
@@ -90,7 +90,7 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
qemu_opt_set(opts, "type", "nic");
ret = net_client_init(opts, 0, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
return NULL;
@@ -322,7 +322,7 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
}
qdev_unplug(&d->qdev, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
error_free(local_err);
return -1;
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index 4c532b7..f0c2536 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -1391,7 +1391,7 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline)
qemu_opt_set(opts, "model", "usb");
idx = net_client_init(opts, 0, &local_err);
- if (error_is_set(&local_err)) {
+ if (local_err) {
qerror_report_err(local_err);
error_free(local_err);
return NULL;