[i2c] fix the return value of rt_i2c_master_send/recv
fix the related PR: #7029
This commit is contained in:
parent
538158bf20
commit
3291882b38
|
@ -122,7 +122,7 @@ rt_ssize_t rt_i2c_master_send(struct rt_i2c_bus_device *bus,
|
||||||
|
|
||||||
ret = rt_i2c_transfer(bus, &msg, 1);
|
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,
|
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);
|
ret = rt_i2c_transfer(bus, &msg, 1);
|
||||||
|
|
||||||
return ret;
|
return (ret == 1) ? count : ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue