From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH] spi: atmel: fix incorrect comparison
Date: Tue, 6 May 2014 17:57:38 +0200 [thread overview]
Message-ID: <53690672.8050708@atmel.com> (raw)
In-Reply-To: <1399391081-16095-1-git-send-email-alexandre.belloni@free-electrons.com>
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@free-electrons.com>
Yes as the variable is declared as unsigned:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.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
next prev parent reply other threads:[~2014-05-06 15:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 15:44 [PATCH] spi: atmel: fix incorrect comparison Alexandre Belloni
2014-05-06 15:57 ` Nicolas Ferre [this message]
2014-05-07 19:50 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53690672.8050708@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=broonie@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).