diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-09-19 14:48:24 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-09-23 12:51:06 +0200 |
commit | 7d553f27fce284805d7f94603932045ee3bbb979 (patch) | |
tree | b1b83b4c53a460660bcaedb45647c28e05397dca /hw/usb/redirect.c | |
parent | dc1f5988454d9dac8b9ba0c35266c8b4bc33ffa1 (diff) | |
download | hqemu-7d553f27fce284805d7f94603932045ee3bbb979.zip hqemu-7d553f27fce284805d7f94603932045ee3bbb979.tar.gz |
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/redirect.c')
-rw-r--r-- | hw/usb/redirect.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 44522d9..95158b3 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1256,6 +1256,7 @@ static void usbredir_device_reject_bh(void *opaque) static void usbredir_do_attach(void *opaque) { USBRedirDevice *dev = opaque; + Error *local_err = NULL; /* In order to work properly with XHCI controllers we need these caps */ if ((dev->dev.port->speedmask & USB_SPEED_MASK_SUPER) && !( @@ -1270,7 +1271,10 @@ static void usbredir_do_attach(void *opaque) return; } - if (usb_device_attach(&dev->dev) != 0) { + usb_device_attach(&dev->dev, &local_err); + if (local_err) { + error_report("%s", error_get_pretty(local_err)); + error_free(local_err); WARNING("rejecting device due to speed mismatch\n"); usbredir_reject_device(dev); } |