diff mbox

iio: buffer: check if a buffer has been set up when poll is called

Message ID 1518679158-16604-1-git-send-email-stefan.windfeldt@axis.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Windfeldt-Prytz Feb. 15, 2018, 7:19 a.m. UTC
If no iio buffer has been set up and poll is called return 0.

Change-Id: I79809c366e2206cfea6159ff8b0a12a988ee549f
Signed-off-by: Stefan Windfeldt-Prytz <stefan.windfeldt@axis.com>
---
 drivers/iio/industrialio-buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 79abf70..cd5bfe3 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -175,7 +175,7 @@  __poll_t iio_buffer_poll(struct file *filp,
 	struct iio_dev *indio_dev = filp->private_data;
 	struct iio_buffer *rb = indio_dev->buffer;
 
-	if (!indio_dev->info)
+	if (!indio_dev->info || rb == NULL)
 		return 0;
 
 	poll_wait(filp, &rb->pollq, wait);