[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1430569876-31428-1-git-send-email-gabriele.mzt@gmail.com>
Date: Sat, 2 May 2015 14:31:16 +0200
From: Gabriele Mazzotta <gabriele.mzt@...il.com>
To: jic23@...nel.org
Cc: knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Gabriele Mazzotta <gabriele.mzt@...il.com>
Subject: [PATCH] iio: kfifo: Set update_needed to false only if a buffer was allocated
Check whether the allocation of a new kfifo buffer failed or not before
setting the update_needed flag to false. This will make
iio_request_update_kfifo() try to allocate a new buffer the next time a
buffer update is requested.
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@...il.com>
---
drivers/iio/kfifo_buf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/kfifo_buf.c b/drivers/iio/kfifo_buf.c
index 847ca56..55c267b 100644
--- a/drivers/iio/kfifo_buf.c
+++ b/drivers/iio/kfifo_buf.c
@@ -38,7 +38,8 @@ static int iio_request_update_kfifo(struct iio_buffer *r)
kfifo_free(&buf->kf);
ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum,
buf->buffer.length);
- buf->update_needed = false;
+ if (ret >= 0)
+ buf->update_needed = false;
} else {
kfifo_reset_out(&buf->kf);
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists