From 81a322d4a1b68d47908a6630bf22897a289722aa Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 14 Aug 2009 10:36:05 +0200 Subject: qdev: add return value to init() callbacks. Sorry folks, but it has to be. One more of these invasive qdev patches. We have a serious design bug in the qdev interface: device init callbacks can't signal failure because the init() callback has no return value. This patch fixes it. We have already one case in-tree where this is needed: Try -device virtio-blk-pci (without drive= specified) and watch qemu segfault. This patch fixes it. With usb+scsi being converted to qdev we'll get more devices where the init callback can fail for various reasons. Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- hw/smbus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/smbus.c') diff --git a/hw/smbus.c b/hw/smbus.c index 5618902e7a..6c1149b9fd 100644 --- a/hw/smbus.c +++ b/hw/smbus.c @@ -198,12 +198,12 @@ static int smbus_i2c_send(i2c_slave *s, uint8_t data) return 0; } -static void smbus_device_init(i2c_slave *i2c) +static int smbus_device_init(i2c_slave *i2c) { SMBusDeviceInfo *t = container_of(i2c->info, SMBusDeviceInfo, i2c); SMBusDevice *dev = FROM_I2C_SLAVE(SMBusDevice, i2c); - t->init(dev); + return t->init(dev); } void smbus_register_device(SMBusDeviceInfo *info) -- cgit v1.2.3