diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-09-19 14:48:39 +0800 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2014-09-23 12:51:07 +0200 |
commit | 77e35b4bbe8ac2cfa3545c9f3ad3d8716b60ddf2 (patch) | |
tree | 35b776a96a9326e4009132758226bf5bbd7d8d08 /hw/usb | |
parent | 5450eeaaad8e27a6cd2b5c4bd55404e50ed1426b (diff) | |
download | qemu-77e35b4bbe8ac2cfa3545c9f3ad3d8716b60ddf2.tar.gz qemu-77e35b4bbe8ac2cfa3545c9f3ad3d8716b60ddf2.tar.bz2 qemu-77e35b4bbe8ac2cfa3545c9f3ad3d8716b60ddf2.zip |
usb-redir: convert init to realize
In this way, all the implementations now use
error_setg instead of qerror_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/redirect.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 95158b3d74..e2c98962a2 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -1361,14 +1361,14 @@ static void usbredir_init_endpoints(USBRedirDevice *dev) } } -static int usbredir_initfn(USBDevice *udev) +static void usbredir_realize(USBDevice *udev, Error **errp) { USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev); int i; if (dev->cs == NULL) { - qerror_report(QERR_MISSING_PARAMETER, "chardev"); - return -1; + error_set(errp, QERR_MISSING_PARAMETER, "chardev"); + return; } if (dev->filter_str) { @@ -1376,9 +1376,9 @@ static int usbredir_initfn(USBDevice *udev) &dev->filter_rules, &dev->filter_rules_count); if (i) { - qerror_report(QERR_INVALID_PARAMETER_VALUE, "filter", - "a usb device filter string"); - return -1; + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "filter", + "a usb device filter string"); + return; } } @@ -1402,7 +1402,6 @@ static int usbredir_initfn(USBDevice *udev) qemu_add_vm_change_state_handler(usbredir_vm_state_change, dev); add_boot_device_path(dev->bootindex, &udev->qdev, NULL); - return 0; } static void usbredir_cleanup_device_queues(USBRedirDevice *dev) @@ -2481,7 +2480,7 @@ static void usbredir_class_initfn(ObjectClass *klass, void *data) USBDeviceClass *uc = USB_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - uc->init = usbredir_initfn; + uc->realize = usbredir_realize; uc->product_desc = "USB Redirection Device"; uc->handle_destroy = usbredir_handle_destroy; uc->cancel_packet = usbredir_cancel_packet; |