linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Windfeldt-Prytz <stefan.windfeldt@axis.com>
To: jic23@kernel.org
Cc: knaack.h@gmx.de, lars@metafoo.de, ppmeerw@pmeerw.net,
	linux-iio@vger.kernel.org,
	Stefan Windfeldt-Prytz <stefanw@axis.com>
Subject: [PATCH] iio: buffer: check if a buffer has been set up when poll is called
Date: Thu, 15 Feb 2018 08:19:18 +0100	[thread overview]
Message-ID: <1518679158-16604-1-git-send-email-stefan.windfeldt@axis.com> (raw)

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 --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);
-- 
2.1.4


                 reply	other threads:[~2018-02-15  7:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518679158-16604-1-git-send-email-stefan.windfeldt@axis.com \
    --to=stefan.windfeldt@axis.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=ppmeerw@pmeerw.net \
    --cc=stefanw@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).