hw/misc/i2c-echo: fix quick smbus transfer
PATCH 1/1 hw/misc/i2c-echo: fix quick smbus transfer
Don't start asynchronous transfer when no tx data is provided.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4457
Signed-off-by Timur Maksimov <[email protected]>
--- hw/misc/i2c-echo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/misc/i2c-echo.c +5 -3
@@ -90,9 +90,11 @@ static int i2c_echo_event(I2CSlave *s, enum i2c_event event)break ;case I2C_FINISH : - state->pos =0 ; - state->state =I2C_ECHO_STATE_START_SEND ; -i2c_bus_master (state->bus, state->bh); +if (state->pos >0 ) { + state->pos =0 ; + state->state =I2C_ECHO_STATE_START_SEND ; +i2c_bus_master (state->bus, state->bh); + }trace_i2c_echo_event (DEVICE (s)->canonical_path,"I2C_FINISH" );break ;
---
base-commit: d73149283205645625bfa9fe029cfb68e4c4a9ae
change-id: 20261022-i2c-echo-quick-fix-3d716d5b642a
Signature · 1 line
Timur Maksimov <[email protected]>