aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-09-19 14:48:28 +0800
committerGerd Hoffmann <kraxel@redhat.com>2014-09-23 12:51:07 +0200
commitf3f8c45972b9d8697e1a2f8bee1b3a1001b2afbf (patch)
treec0f1f3123ad1823cda66fe2373b1a958cdd023ff /hw/usb
parent2e6a0dd1ac45f98f02ebc8c954d9e5e36c7a47fb (diff)
downloadqemu-f3f8c45972b9d8697e1a2f8bee1b3a1001b2afbf.zip
qemu-f3f8c45972b9d8697e1a2f8bee1b3a1001b2afbf.tar.gz
qemu-f3f8c45972b9d8697e1a2f8bee1b3a1001b2afbf.tar.bz2
usb-hub: convert init to realize
In this way, all the implementations now use error_setg instead of error_report for reporting error. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/dev-hub.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index 7492174..0482f58 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -511,15 +511,15 @@ static USBPortOps usb_hub_port_ops = {
.complete = usb_hub_complete,
};
-static int usb_hub_initfn(USBDevice *dev)
+static void usb_hub_realize(USBDevice *dev, Error **errp)
{
USBHubState *s = DO_UPCAST(USBHubState, dev, dev);
USBHubPort *port;
int i;
if (dev->port->hubcount == 5) {
- error_report("usb hub chain too deep");
- return -1;
+ error_setg(errp, "usb hub chain too deep");
+ return;
}
usb_desc_create_serial(dev);
@@ -533,7 +533,6 @@ static int usb_hub_initfn(USBDevice *dev)
usb_port_location(&port->port, dev->port, i+1);
}
usb_hub_handle_reset(dev);
- return 0;
}
static const VMStateDescription vmstate_usb_hub_port = {
@@ -564,7 +563,7 @@ static void usb_hub_class_initfn(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
- uc->init = usb_hub_initfn;
+ uc->realize = usb_hub_realize;
uc->product_desc = "QEMU USB Hub";
uc->usb_desc = &desc_hub;
uc->find_device = usb_hub_find_device;