diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2012-04-20 16:50:25 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-06-04 13:49:35 -0300 |
commit | 4559a1dbcc15a10482de822e2839645a1819ef6f (patch) | |
tree | 9890da3db00eaf564e72d51526aa586a266f9143 /hw | |
parent | 42dcc547e1982f31d0f678e02f0aae5be570384a (diff) | |
download | hqemu-4559a1dbcc15a10482de822e2839645a1819ef6f.zip hqemu-4559a1dbcc15a10482de822e2839645a1819ef6f.tar.gz |
net: net_client_init(): use error_set()
Callers are changed to use qerror_report_err() to keep their QError
semantics.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-By: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci-hotplug.c | 8 | ||||
-rw-r--r-- | hw/usb/dev-network.c | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 785eb3d..61257f4 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -39,6 +39,7 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, const char *devaddr, const char *opts_str) { + Error *local_err = NULL; QemuOpts *opts; PCIBus *bus; int ret, devfn; @@ -60,9 +61,12 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, qemu_opt_set(opts, "type", "nic"); - ret = net_client_init(opts, 0); - if (ret < 0) + ret = net_client_init(opts, 0, &local_err); + if (error_is_set(&local_err)) { + qerror_report_err(local_err); + error_free(local_err); return NULL; + } if (nd_table[ret].devaddr) { monitor_printf(mon, "Parameter addr not supported\n"); return NULL; diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 4e26e64..5d2f098 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -1356,6 +1356,7 @@ static int usb_net_initfn(USBDevice *dev) static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) { + Error *local_err = NULL; USBDevice *dev; QemuOpts *opts; int idx; @@ -1367,8 +1368,10 @@ static USBDevice *usb_net_init(USBBus *bus, const char *cmdline) qemu_opt_set(opts, "type", "nic"); qemu_opt_set(opts, "model", "usb"); - idx = net_client_init(opts, 0); - if (idx == -1) { + idx = net_client_init(opts, 0, &local_err); + if (error_is_set(&local_err)) { + qerror_report_err(local_err); + error_free(local_err); return NULL; } |