From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=39428 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWA9f-0006PT-67 for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWA9d-0000AN-V4 for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46585) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWA9d-0000AF-MO for qemu-devel@nongnu.org; Tue, 06 Jul 2010 11:33:49 -0400 From: Kevin Wolf Date: Tue, 6 Jul 2010 17:33:21 +0200 Message-Id: <1278430406-18667-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1278430406-18667-1-git-send-email-kwolf@redhat.com> References: <1278430406-18667-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 12/17] ide: Improve error messages List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Markus Armbruster Use error_report(), because it points to the error location. Reword "tried to assign twice" messages to make it clear that we're complaining about the unit property. Report invalid unit property instead of failing silently. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- hw/ide/qdev.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 2977a16..221f387 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -18,7 +18,7 @@ */ #include #include "dma.h" - +#include "qemu-error.h" #include /* --------------------------------- */ @@ -40,7 +40,7 @@ static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base) IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus); if (!dev->conf.bs) { - fprintf(stderr, "%s: no drive specified\n", qdev->info->name); + error_report("No drive specified"); goto err; } if (dev->unit == -1) { @@ -49,19 +49,20 @@ static int ide_qdev_init(DeviceState *qdev, DeviceInfo *base) switch (dev->unit) { case 0: if (bus->master) { - fprintf(stderr, "ide: tried to assign master twice\n"); + error_report("IDE unit %d is in use", dev->unit); goto err; } bus->master = dev; break; case 1: if (bus->slave) { - fprintf(stderr, "ide: tried to assign slave twice\n"); + error_report("IDE unit %d is in use", dev->unit); goto err; } bus->slave = dev; break; default: + error_report("Invalid IDE unit %d", dev->unit); goto err; } return info->init(dev); -- 1.6.6.1