OSDN Git Service

pci: don't call qdev pci init method
authorIsaku Yamahata <yamahata@valinux.co.jp>
Tue, 14 Jun 2011 22:37:47 +0000 (07:37 +0900)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 15 Jun 2011 15:32:08 +0000 (18:32 +0300)
As pci id initialization is moved to common layer,
some initialization function can be empty.
So don't call init method if NULL.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/pci.c

index ba0598b..b904a4e 100644 (file)
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1681,10 +1681,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
         do_pci_unregister_device(pci_dev);
         return -1;
     }
-    rc = info->init(pci_dev);
-    if (rc != 0) {
-        do_pci_unregister_device(pci_dev);
-        return rc;
+    if (info->init) {
+        rc = info->init(pci_dev);
+        if (rc != 0) {
+            do_pci_unregister_device(pci_dev);
+            return rc;
+        }
     }
 
     /* rom loading */