From: Linus Walleij Date: Thu, 28 Apr 2016 12:02:41 +0000 (+0200) Subject: iio: light: bh1780: return after write X-Git-Tag: v4.7-rc4~6^2~3^2~17 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=53dfc3b9e6c54d077f578f9016b6c8ab5f891e10;p=karo-tx-linux.git 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 Reported-by: Dan Carpenter Signed-off-by: Linus Walleij Signed-off-by: Jonathan Cameron --- 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)