diff --git a/components/drivers/i2c/i2c-bit-ops.c b/components/drivers/i2c/i2c-bit-ops.c index 96af567a1e..3a9b4efeb3 100644 --- a/components/drivers/i2c/i2c-bit-ops.c +++ b/components/drivers/i2c/i2c-bit-ops.c @@ -375,6 +375,8 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, rt_int32_t i, ret; rt_uint16_t ignore_nack; + if (num == 0) return 0; + for (i = 0; i < num; i++) { msg = &msgs[i];