Skip to contentSkip to conversation

spi: tegra: fix error setting on timeout

PATCH In review Erik Gilling 2 participants 2 messages Oct 14, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: tegra: fix error setting on timeout

avoids derefencing an uninitialized pointer

Change-Id Icf528441ae481e9f6f5ddc0be32c7c217fa49701
---
 drivers/spi/spi_tegra.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi_tegra.c +4 -4
index 0385fde..bb7df02 100644
@@ -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);
Signature · 9 lines
1.7.3.1.1.g1cf9a4


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb

A message that is not in the archive (sent off-list or not yet received): 1287018998-14931-1-git-send-email-konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org

Acked-by
#2 lore raw
Quoted 4 lines · Erik Gilling

avoids derefencing an uninitialized pointer

Change-Id Icf528441ae481e9f6f5ddc0be32c7c217fa49701
Quoted 42 lines
---
 drivers/spi/spi_tegra.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi_tegra.c +4 -4
index 0385fde..bb7df02 100644
@@ -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);
Signature · 13 lines
1.7.3.1.1.g1cf9a4


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
spi-devel-general mailing list
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb