summaryrefslogtreecommitdiff
path: root/drivers/iio/temperature
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-11-05 23:28:18 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-12-08 21:10:28 +0300
commit2e19b6c3efcf074528533c7b98a42bcb1234ebb9 (patch)
treeccfe5ba7dbe4154a86d6657ab900d04a237c531f /drivers/iio/temperature
parent0163c1c521ff8b09cd8ca395003cc00178161d77 (diff)
downloadlinux-2e19b6c3efcf074528533c7b98a42bcb1234ebb9.tar.xz
iio: temperature: ltc2983: fix u32 read into a unsigned long long
Currently the read of temp using of_property_read_u32_index is reading a u32 value into a unsigned long long. This relies on machine endianness to work correctly, so fix this by reading a u32 value and setting temp to this value. Addresses-Coverity: ("Reliance on integer endianness") Fixes: f110f3188e56 ("iio: temperature: Add support for LTC2983") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/temperature')
-rw-r--r--drivers/iio/temperature/ltc2983.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c
index ddf47023364b..d39c0d6b77f1 100644
--- a/drivers/iio/temperature/ltc2983.c
+++ b/drivers/iio/temperature/ltc2983.c
@@ -444,8 +444,10 @@ static struct ltc2983_custom_sensor *__ltc2983_custom_sensor_new(
else
temp = __convert_to_raw(temp, resolution);
} else {
- of_property_read_u32_index(np, propname, index,
- (u32 *)&temp);
+ u32 t32;
+
+ of_property_read_u32_index(np, propname, index, &t32);
+ temp = t32;
}
for (j = 0; j < n_size; j++)