2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 19:53:59 +08:00

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: f110f3188e ("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>
This commit is contained in:
Colin Ian King 2019-11-05 20:28:18 +00:00 committed by Jonathan Cameron
parent 0163c1c521
commit 2e19b6c3ef

View File

@ -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++)