Skip to content

Commit

Permalink
staging: nvec: Reject incomplete messages
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julian Andres Klode authored and Greg Kroah-Hartman committed Sep 30, 2011
1 parent 8da7986 commit 210ceb4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/staging/nvec/nvec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 210ceb4

Please sign in to comment.