Skip to content

Commit

Permalink
spi: pic32: fixup wait_for_completion_timeout return handling
Browse files Browse the repository at this point in the history
wait_for_completion_timeout returns unsigned long not int so the check for
<= 0 should be == 0 here.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Nicholas Mc Guire authored and Mark Brown committed Jul 24, 2016
1 parent 523d939 commit 57c2b0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/spi/spi-pic32.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ static int pic32_spi_one_transfer(struct spi_master *master,
{
struct pic32_spi *pic32s;
bool dma_issued = false;
unsigned long timeout;
int ret;

pic32s = spi_master_get_devdata(master);
Expand Down Expand Up @@ -553,8 +554,8 @@ static int pic32_spi_one_transfer(struct spi_master *master,
}

/* wait for completion */
ret = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
if (ret <= 0) {
timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ);
if (timeout == 0) {
dev_err(&spi->dev, "wait error/timedout\n");
if (dma_issued) {
dmaengine_terminate_all(master->dma_rx);
Expand Down

0 comments on commit 57c2b0d

Please sign in to comment.