Skip to contentSkip to conversation

spi_bitbang: txrx_bufs zero status fix

PATCH New Jan Nikitenko 1 participant 1 message Mar 11, 2008 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi_bitbang: txrx_bufs zero status fix

SPI controller drivers return number of bytes actually transfered from bitbang->txrx_bufs() method. Returned zero number of bytes transfered when non-zero number of bytes to transfer was requested should be recognized as error.
The patch fixes that.

---

 spi_bitbang.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi_bitbang.c +3 -1
index f7f8580..83c911b 100644
@@ -345,7 +345,9 @@ static void bitbang_work(struct work_struct *work)
 				status = bitbang->txrx_bufs(spi, t);
 			}
 			if (status != t->len) {
-				if (status > 0)
+				/* zero status, meaning zero number of bytes
+				 * transfered, is also invalid in this case */
+				if (status >= 0)
 					status = -EMSGSIZE;
 				break;
 			}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
spi-devel-general mailing list spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general