usb: Improve companion configuration error messages
The previous commit broke the additional messages explaining the error messages. Improve the error messages, so they don't need explaining so much. Helps QMP users as well, unlike additional explanations. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
f4bbaaf584
commit
2e269f3d9d
16
hw/usb/bus.c
16
hw/usb/bus.c
@ -374,16 +374,14 @@ void usb_register_companion(const char *masterbus, USBPort *ports[],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bus || !bus->ops->register_companion) {
|
if (!bus) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "masterbus",
|
error_setg(errp, "USB bus '%s' not found", masterbus);
|
||||||
"an USB masterbus");
|
return;
|
||||||
#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);
|
|
||||||
}
|
}
|
||||||
#endif
|
if (!bus->ops->register_companion) {
|
||||||
|
error_setg(errp, "Can't use USB bus '%s' as masterbus,"
|
||||||
|
" it doesn't support companion controllers",
|
||||||
|
masterbus);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -777,26 +777,17 @@ static void ehci_register_companion(USBBus *bus, USBPort *ports[],
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
if (firstport + portcount > NB_PORTS) {
|
if (firstport + portcount > NB_PORTS) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "firstport",
|
error_setg(errp, "firstport must be between 0 and %u",
|
||||||
"firstport on masterbus");
|
NB_PORTS - portcount);
|
||||||
#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);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < portcount; i++) {
|
for (i = 0; i < portcount; i++) {
|
||||||
if (s->companion_ports[firstport + i]) {
|
if (s->companion_ports[firstport + i]) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "masterbus",
|
error_setg(errp, "firstport %u asks for ports %u-%u,"
|
||||||
"an USB masterbus");
|
" but port %u has a companion assigned already",
|
||||||
#if 0 /* conversion from qerror_report() to error_set() broke this: */
|
firstport, firstport, firstport + portcount - 1,
|
||||||
error_printf_unless_qmp(
|
firstport + i);
|
||||||
"port %u on masterbus %s already has a companion assigned\n",
|
|
||||||
firstport + i, bus->qbus.name);
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user