[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for 2.10 11/35] i2c/exynos4210: correctly check
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH for 2.10 11/35] i2c/exynos4210: correctly check i2c_recv() return value |
Date: |
Mon, 24 Jul 2017 22:13:19 +0100 |
On 24 July 2017 at 19:27, Philippe Mathieu-Daudé <address@hidden> wrote:
> i2c_recv() returns -1 on error, if the I2CCON_ACK_GEN bit was not set this
> code
> was setting i2cds = -1.
>
> i2c/exynos4210_i2c.c:117:20: warning: Loss of sign in implicit conversion
> s->i2cds = ret;
> ^~~
>
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/i2c/exynos4210_i2c.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/i2c/exynos4210_i2c.c b/hw/i2c/exynos4210_i2c.c
> index c96fa7d7be..4424dbd233 100644
> --- a/hw/i2c/exynos4210_i2c.c
> +++ b/hw/i2c/exynos4210_i2c.c
> @@ -111,10 +111,12 @@ static void exynos4210_i2c_data_receive(void *opaque)
> s->i2cstat &= ~I2CSTAT_LAST_BIT;
> s->scl_free = false;
> ret = i2c_recv(s->bus);
> - if (ret < 0 && (s->i2ccon & I2CCON_ACK_GEN)) {
> - s->i2cstat |= I2CSTAT_LAST_BIT; /* Data is not acknowledged */
> - } else {
> + if (ret >= 0) {
> s->i2cds = ret;
> + } else {
> + if (s->i2ccon & I2CCON_ACK_GEN) {
> + s->i2cstat |= I2CSTAT_LAST_BIT; /* Data is not acknowledged */
> + }
> }
> exynos4210_i2c_raise_interrupt(s);
> }
> --
Have you checked this change against the data sheet for
the device?
thanks
-- PMM
- [Qemu-devel] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, (continued)
- [Qemu-devel] [PATCH for 2.10 07/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 08/35] qcow2: fix null pointer dereference, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 09/35] ui/vnc: fix leak of SocketAddress **, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 10/35] net/eth: fix incorrect check of iov_to_buf() return value, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 11/35] i2c/exynos4210: correctly check i2c_recv() return value, Philippe Mathieu-Daudé, 2017/07/24
- Re: [Qemu-devel] [PATCH for 2.10 11/35] i2c/exynos4210: correctly check i2c_recv() return value,
Peter Maydell <=
- [Qemu-devel] [PATCH for 2.10 12/35] vfio/platform: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 13/35] vfio/pci: fix use of freed memory, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 15/35] usb: correctly handle Zero Length Packets, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 14/35] vfio/ccw: fix incorrect malloc() size, Philippe Mathieu-Daudé, 2017/07/24
- [Qemu-devel] [PATCH for 2.10 16/35] usb/dev-mtp: fix use of uninitialized values, Philippe Mathieu-Daudé, 2017/07/24