summaryrefslogtreecommitdiff
path: root/drivers/staging/nvec/nvec.c
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@jak-linux.org>2011-09-27 19:01:01 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-29 17:41:37 -0700
commit210ceb4f68dcc7bede2e3af547abd6f661a7bfda (patch)
tree3ff43f9cfeea0173f0cad8dc020cd804cb41a7ec /drivers/staging/nvec/nvec.c
parent8da798634343de8dbb8c1593923f8368db69f838 (diff)
staging: nvec: Reject incomplete messages
Reject incomplete messages, causing the request to be transmitted again. This should fix various problems out there. Signed-off-by: Julian Andres Klode <jak@jak-linux.org> Acked-by: Marc Dietrich <marvin24@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/nvec/nvec.c')
-rw-r--r--drivers/staging/nvec/nvec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index e845f58a8d77..8c01723d681a 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