Skip to content

Commit

Permalink
iio: light: apds9960: silence uninitialized variable warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jonathan Cameron committed Apr 23, 2016
1 parent eb37984 commit f211225
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/iio/light/apds9960.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f211225

Please sign in to comment.