From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: [Qemu-devel] [PATCH v3 19/24] pci-assign: Clean up "Failed to assign" error messages
Date: Fri, 18 Dec 2015 16:35:22 +0100 [thread overview]
Message-ID: <1450452927-8346-20-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1450452927-8346-1-git-send-email-armbru@redhat.com>
The arguments of error_setg() & friends should yield a short error
string without newlines.
Two places try to append additional help to the error message by
embedding newlines in the error string. That's nice, but let's do it
the right way, with error_append_hint().
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
hw/i386/kvm/pci-assign.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
index 0fd6923..eec1340 100644
--- a/hw/i386/kvm/pci-assign.c
+++ b/hw/i386/kvm/pci-assign.c
@@ -770,7 +770,7 @@ static char *assign_failed_examine(const AssignedDevice *dev)
"*** $ echo \"%04x:%02x:%02x.%x\" > /sys/bus/pci/drivers/"
"pci-stub/bind\n"
"*** $ echo \"%04x %04x\" > /sys/bus/pci/drivers/pci-stub/remove_id\n"
- "***",
+ "***\n",
ns, dev->host.domain, dev->host.bus, dev->host.slot,
dev->host.function, vendor_id, device_id,
dev->host.domain, dev->host.bus, dev->host.slot, dev->host.function,
@@ -778,7 +778,7 @@ static char *assign_failed_examine(const AssignedDevice *dev)
dev->host.function, vendor_id, device_id);
fail:
- return g_strdup("Couldn't find out why.");
+ return g_strdup("Couldn't find out why.\n");
}
static void assign_device(AssignedDevice *dev, Error **errp)
@@ -812,8 +812,9 @@ static void assign_device(AssignedDevice *dev, Error **errp)
char *cause;
cause = assign_failed_examine(dev);
- error_setg_errno(errp, -r, "Failed to assign device \"%s\"\n%s",
- dev->dev.qdev.id, cause);
+ error_setg_errno(errp, -r, "Failed to assign device \"%s\"",
+ dev->dev.qdev.id);
+ error_append_hint(errp, "%s", cause);
g_free(cause);
break;
}
@@ -912,11 +913,10 @@ retry:
dev->features |= ASSIGNED_DEVICE_PREFER_MSI_MASK;
goto retry;
}
- error_setg_errno(errp, -r,
- "Failed to assign irq for \"%s\"\n"
- "Perhaps you are assigning a device "
- "that shares an IRQ with another device?",
+ error_setg_errno(errp, -r, "Failed to assign irq for \"%s\"",
dev->dev.qdev.id);
+ error_append_hint(errp, "Perhaps you are assigning a device "
+ "that shares an IRQ with another device?\n");
return r;
}
--
2.4.3
next prev parent reply other threads:[~2015-12-18 15:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 15:35 [Qemu-devel] [PATCH v3 00/24] Error reporting cleanups and fixes Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 01/24] qemu-nbd: Replace BSDism <err.h> by error_report() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 02/24] error: Use error_report_err() where appropriate (again) Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 03/24] error: Use error_report_err() instead of monitor_printf() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 04/24] error: Use error_report_err() instead of ad hoc prints Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 05/24] error: Improve documentation Markus Armbruster
2015-12-18 15:51 ` Eric Blake
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 06/24] block: Clean up "Could not create temporary overlay" error message Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 07/24] qemu-nbd: Clean up "Failed to load snapshot" " Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 08/24] test-throttle: Simplify qemu_init_main_loop() error handling Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 09/24] error: New error_prepend(), error_reportf_err() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 10/24] error: Don't decorate original error message when adding to it Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 11/24] error: Use error_reportf_err() where it makes obvious sense Markus Armbruster
2015-12-18 16:08 ` Eric Blake
2015-12-18 16:22 ` Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 12/24] error: Use error_prepend() " Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 13/24] spapr: Use error_reportf_err() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 14/24] migration: Use error_reportf_err() instead of monitor_printf() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 15/24] qemu-io qemu-nbd: Use error_report() etc. instead of fprintf() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 16/24] error: Strip trailing '\n' from error string arguments (again) Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 17/24] vmdk: Clean up control flow in vmdk_parse_extents() a bit Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 18/24] vmdk: Clean up "Invalid extent lines" error message Markus Armbruster
2015-12-22 1:30 ` Fam Zheng
2015-12-18 15:35 ` Markus Armbruster [this message]
2016-01-04 15:44 ` [Qemu-devel] [PATCH v3 19/24] pci-assign: Clean up "Failed to assign" error messages Laszlo Ersek
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 20/24] vhdx: Fix "log that needs to be replayed" error message Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 21/24] error: Clean up errors with embedded newlines (again) Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 22/24] hw/s390x: Rename local variables Error *l_err to just err Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 23/24] s390/sclp: Simplify control flow in sclp_realize() Markus Armbruster
2015-12-18 15:35 ` [Qemu-devel] [PATCH v3 24/24] error: Consistently name Error * objects err, and not errp Markus Armbruster
2015-12-18 16:11 ` Eric Blake
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=1450452927-8346-20-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=lersek@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).