emul_sbs_gauge: Don't set bad val in i2c msg buf
The SBS Gauge emulator would set the I2C buffer message with a value from the emulator's custom read function even on a read error instead of just returning. This behavior may be improperly relied upon by future tests. Return early on register read before setting the i2c message buffer value in the emulator. Signed-off-by: Aaron Massey <aaronmassey@google.com>
This commit is contained in:
parent
1cff6099f7
commit
1d8750ddd6
|
@ -105,6 +105,10 @@ static int sbs_gauge_emul_transfer_i2c(const struct emul *target, struct i2c_msg
|
|||
switch (msgs->len - 1) {
|
||||
case 1:
|
||||
rc = reg_read(target, reg, &val);
|
||||
if (rc) {
|
||||
/* Return before writing bad value to message buffer */
|
||||
return rc;
|
||||
}
|
||||
msgs->buf[0] = val;
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue