aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/host-libusb.c
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-09-19 14:48:24 +0800
committerGerd Hoffmann <kraxel@redhat.com>2014-09-23 12:51:06 +0200
commit7d553f27fce284805d7f94603932045ee3bbb979 (patch)
treeb1b83b4c53a460660bcaedb45647c28e05397dca /hw/usb/host-libusb.c
parentdc1f5988454d9dac8b9ba0c35266c8b4bc33ffa1 (diff)
usb-bus: convert USBDeviceClass init to realize
Add "realize/unrealize" in USBDeviceClass, which has errp as a parameter. So all the implementations now use error_setg instead of error_report for reporting error. Note: this patch still keep "init" in USBDeviceClass, and call kclass->init in usb_device_realize(), avoid breaking git bisect. After realize all usb devices, will be removed. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/host-libusb.c')
-rw-r--r--hw/usb/host-libusb.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index c189147f91..9f92705b65 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -834,6 +834,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev)
int bus_num = libusb_get_bus_number(dev);
int addr = libusb_get_device_address(dev);
int rc;
+ Error *local_err = NULL;
trace_usb_host_open_started(bus_num, addr);
@@ -869,8 +870,10 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev)
"host:%d.%d", bus_num, addr);
}
- rc = usb_device_attach(udev);
- if (rc) {
+ usb_device_attach(udev, &local_err);
+ if (local_err) {
+ error_report("%s", error_get_pretty(local_err));
+ error_free(local_err);
goto fail;
}