drivers/i2c/dw_i2c: Re-add check for empty i2c transfer list
The check was recently removed to allow callers to pass `count == 0`. Dereferencing the `msg` array is invalid in that case, though. Linux, where we borrowed the i2c interface from, also treats this with -EINVAL. Change-Id: I1eec02dd3a3fcf2d477a62cc65292fca40e469d3 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66341 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
parent
51a35764b3
commit
ee443c8d3e
|
@ -467,7 +467,7 @@ static enum cb_err dw_i2c_transfer(unsigned int bus, const struct i2c_msg *msg,
|
|||
size_t start;
|
||||
uint16_t addr;
|
||||
|
||||
if (!msg)
|
||||
if (count == 0 || !msg)
|
||||
return -1;
|
||||
|
||||
/* Break up the transfers at the differing slave address boundary. */
|
||||
|
|
Loading…
Reference in New Issue