Merge pull request #4401 from howard0su/i2c_security

Return when i2c transfer 0 messages
This commit is contained in:
Bernard Xiong 2021-03-01 19:09:12 +08:00 committed by GitHub
commit 339ebf3c16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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];