summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2015-01-07 02:53:37 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-03 20:33:42 +0100
commit3656cddd50018d562d2df87c4698783898732914 (patch)
treeb463e832e70a6ca3e774a375627f0b5f38acb5c8 /drivers/media
parent[media] mn88472: simplify bandwidth registers setting code (diff)
downloadlinux-3656cddd50018d562d2df87c4698783898732914.tar.xz
linux-3656cddd50018d562d2df87c4698783898732914.zip
[media] lirc_dev: avoid potential null-dereference
We have to check pointer for NULL and then dereference it. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/lirc_dev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 1e0545a67959..4de0e85af805 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -553,14 +553,14 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait)
if (!ir->attached)
return POLLERR;
- poll_wait(file, &ir->buf->wait_poll, wait);
+ if (ir->buf) {
+ poll_wait(file, &ir->buf->wait_poll, wait);
- if (ir->buf)
if (lirc_buffer_empty(ir->buf))
ret = 0;
else
ret = POLLIN | POLLRDNORM;
- else
+ } else
ret = POLLERR;
dev_dbg(ir->d.dev, LOGHEAD "poll result = %d\n",