Skip to contentSkip to conversation

qdev: show name of device that fails init

PATCH New Amit Shah 1 participant 2 messages Sep 29, 2009

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

PATCH 1/2 qdev: show name of device that fails init

When initialising a device fails, show the name of the failing device.

The current behaviour is to silently exit on such errors.

---
 hw/qdev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/qdev.c +1 -0
index a589d72..a04fdb3 100644
@@ -203,6 +203,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
         return NULL;
     }
     if (qdev_init(qdev) != 0) {
+        qemu_error("Error initializing device %s\n", driver);
         qdev_free(qdev);
         return NULL;
     }
Signature · 1 line
1.6.2.5
author
#1 lore raw

PATCH 2/2 virtio-pci: return error if virtio_console_init fails

Currently only one virtio_console device is supported. Trying to add multiple devices fails and such failure should be reported back to the qdev init functions.

---
 hw/virtio-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
hw/virtio-pci.c +3 -0
index bd5a7c4..66967c6 100644
@@ -470,6 +470,9 @@ static int virtio_console_init_pci(PCIDevice *pci_dev)
         proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
 
     vdev = virtio_console_init(&pci_dev->qdev);
+    if (!vdev) {
+        return -1;
+    }
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_CONSOLE,
Signature · 1 line
1.6.2.5