spi: tegra: fix error setting on timeout
authorErik Gilling <konkers@android.com>
Thu, 9 Sep 2010 01:16:45 +0000 (18:16 -0700)
committerErik Gilling <konkers@android.com>
Mon, 25 Oct 2010 23:57:46 +0000 (16:57 -0700)
avoids derefencing an uninitialized pointer

Change-Id: Icf528441ae481e9f6f5ddc0be32c7c217fa49701
Signed-off-by: Erik Gilling <konkers@android.com>
drivers/spi/spi_tegra.c

index 0385fde202a6f5397b354fa49eee4db54bc58229..bb7df02a5472fdf3f7caf73d6ae82a6ffca9464b 100644 (file)
@@ -338,15 +338,15 @@ static void tegra_spi_rx_dma_complete(struct tegra_dma_req *req)
 
        spin_lock_irqsave(&tspi->lock, flags);
 
-       if (timeout >= 1000)
-               m->status = -EIO;
-
        val = spi_tegra_readl(tspi, SLINK_STATUS);
        val |= SLINK_RDY;
        spi_tegra_writel(tspi, val, SLINK_STATUS);
 
-
        m = list_first_entry(&tspi->queue, struct spi_message, queue);
+
+       if (timeout >= 1000)
+               m->status = -EIO;
+
        spi = m->state;
 
        tspi->cur_pos += spi_tegra_drain_rx_fifo(tspi, tspi->cur);