[PATCH v2 23/30] staging: nvec: Reject incomplete messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reject incomplete messages, causing the request to be
transmitted again. This should fix various problems
out there.

Signed-off-by: Julian Andres Klode <jak@xxxxxxxxxxxxx>
Acked-by: Marc Dietrich <marvin24@xxxxxx>
---
 drivers/staging/nvec/nvec.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index e845f58..8c01723 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -439,11 +439,16 @@ static void nvec_tx_completed(struct nvec_chip *nvec)
  */
 static void nvec_rx_completed(struct nvec_chip *nvec)
 {
-	if (nvec->rx->pos != nvec_msg_size(nvec->rx))
+	if (nvec->rx->pos != nvec_msg_size(nvec->rx)) {
 		dev_err(nvec->dev, "RX incomplete: Expected %u bytes, got %u\n",
 			   (uint) nvec_msg_size(nvec->rx),
 			   (uint) nvec->rx->pos);
 
+		nvec_msg_free(nvec, nvec->rx);
+		nvec->state = 0;
+		return;
+	}
+
 	spin_lock(&nvec->rx_lock);
 
 	/* add the received data to the work list
-- 
1.7.5.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux