[PATCH 24/30] staging: nvec: Reject incomplete messages

Julian Andres Klode jak at jak-linux.org
Fri Sep 23 16:38:16 UTC 2011


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

Signed-off-by: Julian Andres Klode <jak at jak-linux.org>
---
 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 83ad1ef..73db97c 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -435,11 +435,16 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
 {
 	unsigned long flags;
 
-	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_irqsave(&nvec->rx_lock, flags);
 
 	/* add the received data to the work list
-- 
1.7.5.4




More information about the devel mailing list