summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-22 13:04:14 +0300
committerJonathan Cameron <jic23@kernel.org>2016-04-23 22:18:09 +0100
commitf21122593d99c7e051891da1b148c771b7d56e07 (patch)
tree01fd6b7cb33aee40d30c7da8d32af3051e292663
parenteb3798463f71afc77abd25b2f62708be06f7173b (diff)
downloadblackbird-op-linux-f21122593d99c7e051891da1b148c771b7d56e07.tar.gz
blackbird-op-linux-f21122593d99c7e051891da1b148c771b7d56e07.zip
iio: light: apds9960: silence uninitialized variable warning
It causes a static checker warning if we use "buf" on the failure path so move that inside the if statement. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/iio/light/apds9960.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index 47fcd5ad4ff2..35928fb1b66a 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -495,9 +495,10 @@ static int apds9960_read_raw(struct iio_dev *indio_dev,
case IIO_INTENSITY:
ret = regmap_bulk_read(data->regmap, chan->address,
&buf, 2);
- if (!ret)
+ if (!ret) {
ret = IIO_VAL_INT;
- *val = le16_to_cpu(buf);
+ *val = le16_to_cpu(buf);
+ }
break;
default:
ret = -EINVAL;
OpenPOWER on IntegriCloud