[i2c] fix the return value of rt_i2c_master_send/recv

fix the related PR: #7029
This commit is contained in:
Wayne 2023-05-09 13:13:02 +08:00 committed by GitHub
parent 538158bf20
commit 3291882b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -122,7 +122,7 @@ rt_ssize_t rt_i2c_master_send(struct rt_i2c_bus_device *bus,
ret = rt_i2c_transfer(bus, &msg, 1);
return ret;
return (ret == 1) ? count : ret;
}
rt_ssize_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus,
@ -142,5 +142,5 @@ rt_ssize_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus,
ret = rt_i2c_transfer(bus, &msg, 1);
return ret;
return (ret == 1) ? count : ret;
}