Skip to content

Commit 20eb1fa

Browse files
Dan Carpenterjic23
authored andcommitted
iio: chemical: bme680: Fix uninitialized variable in __bme680_read_raw()
The bme680_read_temp() function takes a pointer to s16 but we're passing an int pointer to it. This will not work on big endian systems and it also means that the other 16 bits are uninitialized. Pass an s16 type variable. Fixes: f51171c ("iio: chemical: bme680: Add SCALE and RAW channels") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Vasileios Amoiridis <[email protected]> Link: https://patch.msgid.link/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent ab09c6c commit 20eb1fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/iio/chemical/bme680_core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,11 +874,11 @@ static int bme680_read_raw(struct iio_dev *indio_dev,
874874
case IIO_CHAN_INFO_RAW:
875875
switch (chan->type) {
876876
case IIO_TEMP:
877-
ret = bme680_read_temp(data, (s16 *)&chan_val);
877+
ret = bme680_read_temp(data, &temp_chan_val);
878878
if (ret)
879879
return ret;
880880

881-
*val = chan_val;
881+
*val = temp_chan_val;
882882
return IIO_VAL_INT;
883883
case IIO_PRESSURE:
884884
ret = bme680_read_press(data, &chan_val);

0 commit comments

Comments
 (0)