Skip to contentSkip to conversation

qdev: two little fixes.

PATCH New Gerd Hoffmann 1 participant 3 messages Jul 9, 2009

lore
Share & tools
lore
#0 lore raw

cover qdev: two little fixes.

Hi,

This just brings two little bugfixes as incremental patches for the qdev patch series posted last friday, found them while coding / testing more qdev stuff.

If prefered I can also fold them in and repost the whole series.

cheers,
Gerd

#1 lore raw

PATCH 1/2 qdev: catch unknown devices in -device

---
 hw/qdev.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
hw/qdev.c +5 -0
index 979ed4f..009e68d 100644
@@ -133,6 +133,11 @@ DeviceState *qdev_device_add(const char *cmdline)
     }
     info = qdev_find_info(NULL, driver);
 
+    if (!info) {
+        fprintf(stderr, "Device \"%s\" not found.  Try -device '?' for a list.\n",
+                driver);
+        return NULL;
+    }
     if (!info->bus_info->add) {
         fprintf(stderr, "bus \"%s\" can't add devices.\n",
                 info->bus_info->name);
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/2 qdev: fix nic/id windup.

In reply to Gerd Hoffmann
---
 hw/pci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
hw/pci.c +2 -1
index 3410ea7..cc4882e 100644
@@ -821,7 +821,8 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
     for (i = 0; pci_nic_models[i]; i++) {
         if (strcmp(nd->model, pci_nic_models[i]) == 0) {
             dev = pci_create(pci_nic_names[i], devaddr);
-            snprintf(dev->id, sizeof(dev->id), "%s", nd->id);
+            if (nd->id)
+                snprintf(dev->id, sizeof(dev->id), "%s", nd->id);
             dev->nd = nd;
             qdev_init(dev);
             nd->private = dev;
Signature · 1 line
1.6.2.5