From patchwork Wed Jun 30 11:55:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 57403 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 84CF0B6F01 for ; Wed, 30 Jun 2010 22:10:24 +1000 (EST) Received: from localhost ([127.0.0.1]:53600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTw7R-00011K-F6 for incoming@patchwork.ozlabs.org; Wed, 30 Jun 2010 08:10:21 -0400 Received: from [140.186.70.92] (port=56896 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTvtN-0000lT-Tk for qemu-devel@nongnu.org; Wed, 30 Jun 2010 07:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTvtM-0000Zl-2F for qemu-devel@nongnu.org; Wed, 30 Jun 2010 07:55:49 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:57047) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTvtL-0000ZU-Ss for qemu-devel@nongnu.org; Wed, 30 Jun 2010 07:55:48 -0400 Received: from blackfin.pond.sub.org (pD951BCA6.dip.t-dialin.net [217.81.188.166]) by oxygen.pond.sub.org (Postfix) with ESMTPA id DCF1D2E2B3F; Wed, 30 Jun 2010 13:55:44 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 2BE91428; Wed, 30 Jun 2010 13:55:43 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 30 Jun 2010 13:55:38 +0200 Message-Id: <1277898942-6501-8-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1277898942-6501-1-git-send-email-armbru@redhat.com> References: <1277898942-6501-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de Subject: [Qemu-devel] [PATCH 07/11] ide: Improve error messages X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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);