From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWP94-0006S4-5Y for qemu-devel@nongnu.org; Tue, 23 Sep 2014 08:24:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWP8z-0005T2-Bt for qemu-devel@nongnu.org; Tue, 23 Sep 2014 08:24:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWP8z-0005S5-3T for qemu-devel@nongnu.org; Tue, 23 Sep 2014 08:24:33 -0400 From: Gerd Hoffmann Date: Tue, 23 Sep 2014 14:13:19 +0200 Message-Id: <1411474417-9704-9-git-send-email-kraxel@redhat.com> In-Reply-To: <1411474417-9704-1-git-send-email-kraxel@redhat.com> References: <1411474417-9704-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 08/26] usb-hub: convert init to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gonglei , Gerd Hoffmann From: Gonglei In this way, all the implementations now use error_setg instead of error_report for reporting error. Signed-off-by: Gonglei Reviewed-by: Paolo Bonzini Signed-off-by: Gerd Hoffmann --- hw/usb/dev-hub.c | 9 ++++----- 1 file 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; -- 1.8.3.1