summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-04-28 14:02:41 +0200
committerJonathan Cameron <jic23@kernel.org>2016-05-04 10:53:51 +0100
commit53dfc3b9e6c54d077f578f9016b6c8ab5f891e10 (patch)
tree1b46775e0d7480f030ab86ce9b2d9a4a19879c11
parent04bf02175fe9577875fb8285cc2d08169fef613a (diff)
downloadblackbird-op-linux-53dfc3b9e6c54d077f578f9016b6c8ab5f891e10.tar.gz
blackbird-op-linux-53dfc3b9e6c54d077f578f9016b6c8ab5f891e10.zip
iio: light: bh1780: return after write
When writing a value using direct reg access from debugfs we need to return and not fall through to reading the value, lest we'll dereference a NULL pointer. Cc: Dan Carpenter <dan.carpenter@oracle.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/light/bh1780.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
index 72b364e4aa72..f83595334ff1 100644
--- a/drivers/iio/light/bh1780.c
+++ b/drivers/iio/light/bh1780.c
@@ -84,7 +84,7 @@ static int bh1780_debugfs_reg_access(struct iio_dev *indio_dev,
int ret;
if (!readval)
- bh1780_write(bh1780, (u8)reg, (u8)writeval);
+ return bh1780_write(bh1780, (u8)reg, (u8)writeval);
ret = bh1780_read(bh1780, (u8)reg);
if (ret < 0)
OpenPOWER on IntegriCloud