From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Lorenzo Bianconi , Jonathan Cameron , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 066/124] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot() Date: Mon, 19 Mar 2018 15:48:12 +0000 Message-ID: <20180319154645.11350-66-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: From: Lorenzo Bianconi [ Upstream commit 7b9ebe428266fb7e0a6d769bb3ff3fcb6044b15e ] Apply le16_to_cpu() to data read from the sensor in order to take into account architecture endianness Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver) Signed-off-by: Lorenzo Bianconi Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu= /st_lsm6dsx/st_lsm6dsx_core.c index 239c735242be..812cd25f284e 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -448,7 +448,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_se= nsor *sensor, =20 st_lsm6dsx_sensor_disable(sensor); =20 - *val =3D (s16)data; + *val =3D (s16)le16_to_cpu(data); =20 return IIO_VAL_INT; } --=20 2.14.1