From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1DHr-0006H4-MJ for qemu-devel@nongnu.org; Mon, 22 Jul 2013 06:24:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1DHq-0002IT-H7 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 06:24:15 -0400 Message-ID: <51ED0844.1060809@suse.de> Date: Mon, 22 Jul 2013 12:24:04 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <7da0c8dce11d32c300df10dade5e099b3aae7114.1372673778.git.hutao@cn.fujitsu.com> <1374402654-23574-1-git-send-email-afaerber@suse.de> <20130722091646.GC2668@G08FNSTD100614.fnst.cn.fujitsu.com> In-Reply-To: <20130722091646.GC2668@G08FNSTD100614.fnst.cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-next] scsi: Improve error propagation for scsi_bus_legacy_handle_cmdline() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: Anthony Liguori , "Michael S. Tsirkin" , Alexander Graf , qemu-devel@nongnu.org, qemu-ppc , Paul Brook , Paolo Bonzini , Luiz Capitulino , Gerd Hoffmann Am 22.07.2013 11:16, schrieb Hu Tao: > On Sun, Jul 21, 2013 at 12:30:54PM +0200, Andreas F=C3=A4rber wrote: >> Let scsi_bus_legacy_add_drive() and scsi_bus_legacy_handle_cmdline() >> return an Error**. Prepare qdev initfns for QOM realize error model. >> >> Signed-off-by: Andreas F=C3=A4rber >> --- >> hw/pci/pci-hotplug-old.c | 2 +- >> hw/scsi/esp-pci.c | 7 ++++++- >> hw/scsi/esp.c | 6 ++++-- >> hw/scsi/lsi53c895a.c | 7 ++++++- >> hw/scsi/megasas.c | 7 ++++++- >> hw/scsi/scsi-bus.c | 22 +++++++++++++++------- >> hw/scsi/spapr_vscsi.c | 7 ++++++- >> hw/scsi/virtio-scsi.c | 7 ++++++- >> hw/usb/dev-storage.c | 4 +++- >> include/hw/scsi/scsi.h | 4 ++-- >> 10 files changed, 55 insertions(+), 18 deletions(-) >> >> diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c >> index 8077289..619fe47 100644 >> --- a/hw/pci/pci-hotplug-old.c >> +++ b/hw/pci/pci-hotplug-old.c >> @@ -127,7 +127,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState = *adapter, >> dinfo->unit =3D qemu_opt_get_number(dinfo->opts, "unit", -1); >> dinfo->bus =3D scsibus->busnr; >> scsidev =3D scsi_bus_legacy_add_drive(scsibus, dinfo->bdrv, dinfo= ->unit, >> - false, -1, NULL); >> + false, -1, NULL, NULL); >> if (!scsidev) { >> return -1; >> } >> diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c >> index 6cdfd53..2ac21d4 100644 >> --- a/hw/scsi/esp-pci.c >> +++ b/hw/scsi/esp-pci.c >> @@ -346,6 +346,7 @@ static int esp_pci_scsi_init(PCIDevice *dev) >> DeviceState *d =3D DEVICE(dev); >> ESPState *s =3D &pci->esp; >> uint8_t *pci_conf; >> + Error *err =3D NULL; >> =20 >> pci_conf =3D dev->config; >> =20 >> @@ -364,7 +365,11 @@ static int esp_pci_scsi_init(PCIDevice *dev) >> =20 >> scsi_bus_new(&s->bus, d, &esp_pci_scsi_info, NULL); >> if (!d->hotplugged) { >> - return scsi_bus_legacy_handle_cmdline(&s->bus); >> + scsi_bus_legacy_handle_cmdline(&s->bus, &err); >> + if (err !=3D NULL) { >=20 > if (error_is_set(&err)) I was specifically instructed not to use error_is_set() on local err variables. It is intended for potentially-NULL errp only, which &err will never be. Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg