Received: from eggs.gnu.org ([2001:4830:134:3::10]:56856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnmNq-00017d-RK for qemu-devel@nongnu.org; Tue, 03 Dec 2013 04:35:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnmNk-0005m3-7d for qemu-devel@nongnu.org; Tue, 03 Dec 2013 04:35:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37474) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnmNj-0005ke-VP for qemu-devel@nongnu.org; Tue, 03 Dec 2013 04:35:04 -0500 From: Markus Armbruster References: <6f22de9cc11bca34cce114adbeaf6c3486f5a822.1386049636.git.peter.crosthwaite@xilinx.com> Date: Tue, 03 Dec 2013 10:35:00 +0100 In-Reply-To: <6f22de9cc11bca34cce114adbeaf6c3486f5a822.1386049636.git.peter.crosthwaite@xilinx.com> (Peter Crosthwaite's message of "Mon, 2 Dec 2013 21:50:29 -0800") Message-ID: <87y542p9a3.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [RFC PATCH v1 2/5] hw: Remove assert_no_error usages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: imammedo@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de Peter Crosthwaite writes: > Replace assert_no_error() usages with the error_abort system. > &error_abort is passed into API calls to signal to the Error sub-system > that any errors are fatal. Removes need for caller assertions. > > Signed-off-by: Peter Crosthwaite [...] > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index e374a93..7d869fc 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c [...] > @@ -739,31 +737,19 @@ static void device_initfn(Object *obj) > class = object_get_class(OBJECT(dev)); > do { > for (prop = DEVICE_CLASS(class)->props; prop && prop->name; prop++) { > - qdev_property_add_legacy(dev, prop, &err); > - assert_no_error(err); > - qdev_property_add_static(dev, prop, &err); > - assert_no_error(err); > + qdev_property_add_legacy(dev, prop, &error_abort); > + qdev_property_add_static(dev, prop, &error_abort); > } > class = object_class_get_parent(class); > } while (class != object_class_by_name(TYPE_DEVICE)); > - if (err != NULL) { > - qerror_report_err(err); > - error_free(err); > - exit(1); > - } Removal of these five lines isn't about replacing assert_no_error(), it's burying dead code: err is initialized to null, and every place where err can be set is followed by an assert_no_error(), therefore err must still be null here. Correct? > > object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS, > - (Object **)&dev->parent_bus, &err); > - assert_no_error(err); > + (Object **)&dev->parent_bus, &error_abort); > } > > static void device_post_init(Object *obj) > { > - DeviceState *dev = DEVICE(obj); > - Error *err = NULL; > - > - qdev_prop_set_globals(dev, &err); > - assert_no_error(err); > + qdev_prop_set_globals(DEVICE(obj), &error_abort); > } > > /* Unlink device from bus and free the structure. */ > diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c > index d67c5f1..bb92e41 100644 > --- a/hw/dma/xilinx_axidma.c > +++ b/hw/dma/xilinx_axidma.c > @@ -569,26 +569,21 @@ static void xilinx_axidma_init(Object *obj) > { > XilinxAXIDMA *s = XILINX_AXI_DMA(obj); > SysBusDevice *sbd = SYS_BUS_DEVICE(obj); > - Error *errp = NULL; > > object_property_add_link(obj, "axistream-connected", TYPE_STREAM_SLAVE, > - (Object **) &s->tx_data_dev, &errp); > - assert_no_error(errp); > + (Object **) &s->tx_data_dev, &error_abort); You could use the opportunity and drop the space between cast and its operand, for consistency with the other casts around here. No need to respin just for that, of course. [...]