summaryrefslogtreecommitdiffstats
path: root/hw/qdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index c1a7779..1b7d963 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -199,16 +199,19 @@ DeviceState *qdev_device_add(QemuOpts *opts)
qdev_free(qdev);
return NULL;
}
- qdev_init(qdev);
+ if (qdev_init(qdev) != 0) {
+ qdev_free(qdev);
+ return NULL;
+ }
return qdev;
}
/* Initialize a device. Device properties should be set before calling
this function. IRQs and MMIO regions should be connected/mapped after
calling this function. */
-void qdev_init(DeviceState *dev)
+int qdev_init(DeviceState *dev)
{
- dev->info->init(dev, dev->info);
+ return dev->info->init(dev, dev->info);
}
/* Unlink device from bus and free the structure. */
OpenPOWER on IntegriCloud