qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 02/13] usb: Improve companion configuration error messages
Date: Wed, 18 Mar 2015 14:07:44 +0100	[thread overview]
Message-ID: <1426684075-27224-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1426684075-27224-1-git-send-email-kraxel@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

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>
---
 hw/usb/bus.c      | 18 ++++++++----------
 hw/usb/hcd-ehci.c | 21 ++++++---------------
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 98e33ea..3751675 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -374,16 +374,14 @@ void usb_register_companion(const char *masterbus, USBPort *ports[],
         }
     }
 
-    if (!bus || !bus->ops->register_companion) {
-        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);
-        }
-#endif
+    if (!bus) {
+        error_setg(errp, "USB bus '%s' not found", masterbus);
+        return;
+    }
+    if (!bus->ops->register_companion) {
+        error_setg(errp, "Can't use USB bus '%s' as masterbus,"
+                   " it doesn't support companion controllers",
+                   masterbus);
         return;
     }
 
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 7d16ba8..5c2a452 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -777,26 +777,17 @@ static void ehci_register_companion(USBBus *bus, USBPort *ports[],
     uint32_t i;
 
     if (firstport + portcount > NB_PORTS) {
-        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);
-#endif
+        error_setg(errp, "firstport must be between 0 and %u",
+                   NB_PORTS - portcount);
         return;
     }
 
     for (i = 0; i < portcount; i++) {
         if (s->companion_ports[firstport + i]) {
-            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);
-#endif
+            error_setg(errp, "firstport %u asks for ports %u-%u,"
+                       " but port %u has a companion assigned already",
+                       firstport, firstport, firstport + portcount - 1,
+                       firstport + i);
             return;
         }
     }
-- 
1.8.3.1

  parent reply	other threads:[~2015-03-18 13:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 13:07 [Qemu-devel] [PULL for-2.3 00/13] usb patch queue Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 01/13] usb: Propagate errors through usb_register_companion() Gerd Hoffmann
2015-03-18 13:07 ` Gerd Hoffmann [this message]
2015-03-18 13:07 ` [Qemu-devel] [PULL 03/13] ohci: Complete conversion to realize Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 04/13] uhci: Convert " Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 05/13] monitor: Drop dead QMP check from monitor_read_password() Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 06/13] monitor: Plug memory leak in monitor_read_bdrv_key_start() Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 07/13] monitor usb: Inline monitor_read_bdrv_key_start()'s first part Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 08/13] usb/dev-storage: Fix QMP device_add missing encryption key failure Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 09/13] usb/dev-storage: Avoid qerror_report_err() outside QMP handlers Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 10/13] hw/usb: Include USB files only if necessary Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 11/13] uhci: fix segfault when hot-unplugging uhci controller Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 12/13] ohci: fix resource cleanup leak Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 13/13] ehci: fix segfault when hot-unplugging ehci controller Gerd Hoffmann
2015-03-19 12:11 ` [Qemu-devel] [PULL for-2.3 00/13] usb patch queue Peter Maydell
2015-03-19 14:50   ` Gerd Hoffmann
2015-03-19 19:00     ` Peter Maydell
2015-03-19 19:33       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426684075-27224-3-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).