[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53690672.8050708@atmel.com>
Date: Tue, 6 May 2014 17:57:38 +0200
From: Nicolas Ferre <nicolas.ferre@...el.com>
To: Mark Brown <broonie@...nel.org>
CC: Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-spi@...r.kernel.org>
Subject: Re: [PATCH] spi: atmel: fix incorrect comparison
On 06/05/2014 17:44, Alexandre Belloni :
> Found using smatch:
> drivers/spi/spi-atmel.c:878 atmel_spi_pump_pio_data() warn: unsigned
> 'as->current_remaining_bytes' is never less than zero.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
Yes as the variable is declared as unsigned:
Acked-by: Nicolas Ferre <nicolas.ferre@...el.com>
> ---
> drivers/spi/spi-atmel.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 079e6b1b0cdb..39417fd8462f 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -874,8 +874,9 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer)
> spi_readl(as, RDR);
> }
> if (xfer->bits_per_word > 8) {
> - as->current_remaining_bytes -= 2;
> - if (as->current_remaining_bytes < 0)
> + if (as->current_remaining_bytes > 2)
> + as->current_remaining_bytes -= 2;
> + else
> as->current_remaining_bytes = 0;
> } else {
> as->current_remaining_bytes--;
>
--
Nicolas Ferre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists