pci: don't call qdev pci init method

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>
This commit is contained in:
Isaku Yamahata 2011-06-15 07:37:47 +09:00 committed by Michael S. Tsirkin
parent befeac45d4
commit c2afc92290
1 changed files with 6 additions and 4 deletions

View File

@ -1681,10 +1681,12 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo *base)
do_pci_unregister_device(pci_dev); do_pci_unregister_device(pci_dev);
return -1; return -1;
} }
rc = info->init(pci_dev); if (info->init) {
if (rc != 0) { rc = info->init(pci_dev);
do_pci_unregister_device(pci_dev); if (rc != 0) {
return rc; do_pci_unregister_device(pci_dev);
return rc;
}
} }
/* rom loading */ /* rom loading */