diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-02-17 14:28:02 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2015-03-17 14:11:42 +0100 |
commit | f4bbaaf584ed8d0a430b467bace15f338cba4c57 (patch) | |
tree | ea99c54741464dba6c0f851c6ab4673eb463a8e5 /hw/usb/bus.c | |
parent | 5a4992834daec85c3913654903fb9f4f954e585a (diff) |
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/bus.c')
-rw-r--r-- | hw/usb/bus.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 91fc3e20d9..98e33ea31a 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -360,9 +360,10 @@ void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index, bus->nfree++; } -int usb_register_companion(const char *masterbus, USBPort *ports[], - uint32_t portcount, uint32_t firstport, - void *opaque, USBPortOps *ops, int speedmask) +void usb_register_companion(const char *masterbus, USBPort *ports[], + uint32_t portcount, uint32_t firstport, + void *opaque, USBPortOps *ops, int speedmask, + Error **errp) { USBBus *bus; int i; @@ -374,21 +375,23 @@ int usb_register_companion(const char *masterbus, USBPort *ports[], } if (!bus || !bus->ops->register_companion) { - 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: */ if (bus) { error_printf_unless_qmp( "USB bus '%s' does not allow companion controllers\n", masterbus); } - return -1; +#endif + return; } for (i = 0; i < portcount; i++) { usb_fill_port(ports[i], opaque, i, ops, speedmask); } - return bus->ops->register_companion(bus, ports, portcount, firstport); + bus->ops->register_companion(bus, ports, portcount, firstport, errp); } void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr) |