iio: adc: at91-sama5d2_adc: fix up casting in at91_adc_read_info_raw()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 9 Jul 2018 11:06:59 +0000 (14:06 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Jul 2018 18:18:12 +0000 (19:18 +0100)
commita176ba37e6282207be3f012fb58b77c6f51d55d9
tree3951630400e9461f333640ba65bdcc060262121e
parent69f894c3f3185d3826ea6573afb282386b797acf
iio: adc: at91-sama5d2_adc: fix up casting in at91_adc_read_info_raw()

This code is problematic because we're supposed to be writing an int but
we instead write to only the high 16 bits.  This doesn't work on big
endian systems, and there is a potential that the bottom 16 bits are
used without being initialized.

Fixes: 23ec2774f1cc ("iio: adc: at91-sama5d2_adc: add support for position and pressure channels")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Eugen Hristev <eugen.hristev@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/at91-sama5d2_adc.c