diff options
-rw-r--r-- | src/drivers/i2c/designware/dw_i2c.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/drivers/i2c/designware/dw_i2c.c b/src/drivers/i2c/designware/dw_i2c.c index 1e3163a736..a08036720b 100644 --- a/src/drivers/i2c/designware/dw_i2c.c +++ b/src/drivers/i2c/designware/dw_i2c.c @@ -857,7 +857,12 @@ void dw_i2c_acpi_fill_ssdt(const struct device *dev) static int dw_i2c_dev_transfer(struct device *dev, const struct i2c_msg *msg, size_t count) { - return dw_i2c_transfer(dw_i2c_soc_dev_to_bus(dev), msg, count); + int bus = dw_i2c_soc_dev_to_bus(dev); + if (bus < 0) { + printk(BIOS_ERR, "Invalid I2C bus number.\n"); + return -1; + } + return dw_i2c_transfer(bus, msg, count); } const struct i2c_bus_operations dw_i2c_bus_ops = { |