diff options
Diffstat (limited to 'hw/i2c/core.c')
-rw-r--r-- | hw/i2c/core.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/i2c/core.c b/hw/i2c/core.c index abd4c4cddb..e40781ea3b 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -260,7 +260,11 @@ static int i2c_slave_qdev_init(DeviceState *dev) I2CSlave *s = I2C_SLAVE(dev); I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s); - return sc->init(s); + if (sc->init) { + return sc->init(s); + } + + return 0; } DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr) |