Skip to contentSkip to conversation

spi_bfin5xx: limit reaches -1

PATCH In review Roel Kluin 2 participants 2 messages Apr 16, 2009 1 message not in the archive SPI

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 spi_bfin5xx: limit reaches -1

bfin_spi_flush() returns limit, which reaches -1 upon timeout. but in function bfin_spi_pump_transfers() it is compared with 0.

---

drivers/spi/spi_bfin5xx.c +1 -1
index f014cc2..6545b0c 100644
@@ -169,7 +169,7 @@ static int bfin_spi_flush(struct driver_data *drv_data)
 	unsigned long limit = loops_per_jiffy << 1;
 
 	/* wait for stop and clear stat */
-	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
+	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && --limit)
 		cpu_relax();
 
 	write_STAT(drv_data, BIT_STAT_CLR);

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p

#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Roel Kluin

bfin_spi_flush() returns limit, which reaches -1 upon timeout. but in function bfin_spi_pump_transfers() it is compared with 0.

... although this could trigger a rarely-seen-before fault path in this driver, which I hope won't cause trouble. Bryan?

Quoted 8 lines

---

drivers/spi/spi_bfin5xx.c +0 -0
index f014cc2..6545b0c 100644

drivers/spi/spi_bfin5xx.c static int bfin_spi_flush(struct driver_data *drv_data) · line 175

Quoted 8 lines
drivers/spi/spi_bfin5xx.c +1 -1
@@ -169,7 +169,7 @@ static int bfin_spi_flush(struct driver_data *drv_data)
 	unsigned long limit = loops_per_jiffy << 1;
 
 	/* wait for stop and clear stat */
-	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
+	while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && --limit)
 		cpu_relax();
 
 	write_STAT(drv_data, BIT_STAT_CLR);

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p