summary refs log tree commit diff stats
path: root/hw/usb/hcd-ehci.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-17 14:28:02 +0100
committerGerd Hoffmann <kraxel@redhat.com>2015-03-17 14:11:42 +0100
commitf4bbaaf584ed8d0a430b467bace15f338cba4c57 (patch)
treeea99c54741464dba6c0f851c6ab4673eb463a8e5 /hw/usb/hcd-ehci.c
parent5a4992834daec85c3913654903fb9f4f954e585a (diff)
downloadfocaccia-qemu-f4bbaaf584ed8d0a430b467bace15f338cba4c57.tar.gz
focaccia-qemu-f4bbaaf584ed8d0a430b467bace15f338cba4c57.zip
usb: Propagate errors through usb_register_companion()
This loses the messages explaining the error printed with
error_printf_unless_qmp().  The next commit will make up for the loss.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-ehci.c')
-rw-r--r--hw/usb/hcd-ehci.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index ccf54b6e09..7d16ba83bf 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -769,30 +769,35 @@ static void ehci_wakeup(USBPort *port)
     qemu_bh_schedule(s->async_bh);
 }
 
-static int ehci_register_companion(USBBus *bus, USBPort *ports[],
-                                   uint32_t portcount, uint32_t firstport)
+static void ehci_register_companion(USBBus *bus, USBPort *ports[],
+                                    uint32_t portcount, uint32_t firstport,
+                                    Error **errp)
 {
     EHCIState *s = container_of(bus, EHCIState, bus);
     uint32_t i;
 
     if (firstport + portcount > NB_PORTS) {
-        qerror_report(QERR_INVALID_PARAMETER_VALUE, "firstport",
-                      "firstport on masterbus");
+        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "firstport",
+                  "firstport on masterbus");
+#if 0 /* conversion from qerror_report() to error_set() broke this: */
         error_printf_unless_qmp(
             "firstport value of %u makes companion take ports %u - %u, which "
             "is outside of the valid range of 0 - %u\n", firstport, firstport,
             firstport + portcount - 1, NB_PORTS - 1);
-        return -1;
+#endif
+        return;
     }
 
     for (i = 0; i < portcount; i++) {
         if (s->companion_ports[firstport + i]) {
-            qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus",
-                          "an USB masterbus");
+            error_set(errp, QERR_INVALID_PARAMETER_VALUE, "masterbus",
+                      "an USB masterbus");
+#if 0 /* conversion from qerror_report() to error_set() broke this: */
             error_printf_unless_qmp(
                 "port %u on masterbus %s already has a companion assigned\n",
                 firstport + i, bus->qbus.name);
-            return -1;
+#endif
+            return;
         }
     }
 
@@ -806,8 +811,6 @@ static int ehci_register_companion(USBBus *bus, USBPort *ports[],
 
     s->companion_count++;
     s->caps[0x05] = (s->companion_count << 4) | portcount;
-
-    return 0;
 }
 
 static void ehci_wakeup_endpoint(USBBus *bus, USBEndpoint *ep,