qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: Clean up error reporting in pci_nic_init()
@ 2015-04-27 17:51 Thomas Huth
  2015-04-27 17:55 ` Peter Crosthwaite
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Huth @ 2015-04-27 17:51 UTC (permalink / raw)
  To: qemu-devel, Michael S. Tsirkin; +Cc: Markus Armbruster

The error reporting in pci_nic_init() is quite erratic: Some errors
are printed directly with error_report(), and some are passed back
to the (only) caller pci_nic_init_nofail() via an Error pointer.
Let's fix up this inconsistency by always printing the error in
pci_nic_init() and by getting rid of the Error pointer this way.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/pci/pci.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index b3d5100..6dac107 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1613,8 +1613,7 @@ static const char * const pci_nic_names[] = {
 /* Initialize a PCI NIC.  */
 static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
                                const char *default_model,
-                               const char *default_devaddr,
-                               Error **errp)
+                               const char *default_devaddr)
 {
     const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
     Error *err = NULL;
@@ -1641,7 +1640,7 @@ static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
 
     object_property_set_bool(OBJECT(dev), true, "realized", &err);
     if (err) {
-        error_propagate(errp, err);
+        error_report_err(err);
         object_unparent(OBJECT(dev));
         return NULL;
     }
@@ -1652,17 +1651,13 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
                                const char *default_model,
                                const char *default_devaddr)
 {
-    Error *err = NULL;
     PCIDevice *res;
 
     if (qemu_show_nic_models(nd->model, pci_nic_models))
         exit(0);
 
-    res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err);
+    res = pci_nic_init(nd, rootbus, default_model, default_devaddr);
     if (!res) {
-        if (err) {
-            error_report_err(err);
-        }
         exit(1);
     }
     return res;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-28 10:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-27 17:51 [Qemu-devel] [PATCH] pci: Clean up error reporting in pci_nic_init() Thomas Huth
2015-04-27 17:55 ` Peter Crosthwaite
2015-04-28  7:26   ` Thomas Huth
2015-04-28  8:40     ` Michael S. Tsirkin
2015-04-28 10:56       ` Thomas Huth

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).