From 8da798634343de8dbb8c1593923f8368db69f838 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 27 Sep 2011 19:01:00 +0200 Subject: [PATCH] staging: nvec: Handle filled up RX buffers If no RX buffer is available in state 1, jump to state 0 again. This will produce an incredible amount of warnings, but it is not supposed to happen anyway. Signed-off-by: Julian Andres Klode Acked-by: Marc Dietrich Signed-off-by: Greg Kroah-Hartman --- drivers/staging/nvec/nvec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index c05adcd7fbfd..e845f58a8d77 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c @@ -554,6 +554,11 @@ static irqreturn_t nvec_interrupt(int irq, void *dev) nvec_invalid_flags(nvec, status, true); } else { nvec->rx = nvec_msg_alloc(nvec, NVEC_MSG_RX); + /* Should not happen in a normal world */ + if (unlikely(nvec->rx == NULL)) { + nvec->state = 0; + break; + } nvec->rx->data[0] = received; nvec->rx->pos = 1; nvec->state = 2;