diff options
author | Corey Minyard <cminyard@mvista.com> | 2018-11-20 11:13:42 -0600 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2019-02-27 21:06:08 -0600 |
commit | bc15cde0c4acc9128f26ff78f99ce34a59200d5e (patch) | |
tree | 7faa1aea444e191365aacec055a9dec8bde235b6 /hw/i2c/imx_i2c.c | |
parent | 05f9f17e2caf249e9454f43e0c3751b2d06e1c06 (diff) |
i2c: Don't check return value from i2c_recv()
i2c_recv() cannot fail, so there is no need to check the return
value. It also returns unt8_t, so comparing with < 0 is not
meaningful.
Fix up various I2C controllers to remove the unneeded code.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i2c/imx_i2c.c')
-rw-r--r-- | hw/i2c/imx_i2c.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c index 6c81b98ebd..6da5224e2e 100644 --- a/hw/i2c/imx_i2c.c +++ b/hw/i2c/imx_i2c.c @@ -120,7 +120,7 @@ static uint64_t imx_i2c_read(void *opaque, hwaddr offset, value = s->i2dr_read; if (imx_i2c_is_master(s)) { - int ret = 0xff; + uint8_t ret = 0xff; if (s->address == ADDR_RESET) { /* something is wrong as the address is not set */ @@ -133,15 +133,7 @@ static uint64_t imx_i2c_read(void *opaque, hwaddr offset, } else { /* get the next byte */ ret = i2c_recv(s->bus); - - if (ret >= 0) { - imx_i2c_raise_interrupt(s); - } else { - qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: read failed " - "for device 0x%02x\n", TYPE_IMX_I2C, - __func__, s->address); - ret = 0xff; - } + imx_i2c_raise_interrupt(s); } s->i2dr_read = ret; |