]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
authorsayli karnik <karniksayli1995@gmail.com>
Tue, 11 Oct 2016 11:37:21 +0000 (17:07 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Jan 2021 12:35:51 +0000 (13:35 +0100)
commit dd4ba3fb22233e69f06399ee0aa7ecb11d2b595c upstream

There is a type mismatch between the buffer which is of type s16 and the
samples stored, which are declared as __le16.

Fix the following sparse warning:
drivers/iio/imu/bmi160/bmi160_core.c:411:26: warning: incorrect type
in assignment (different base types)

drivers/iio/imu/bmi160/bmi160_core.c:411:26: expected signed short
[signed] [short] [explicitly-signed] <noident>
drivers/iio/imu/bmi160/bmi160_core.c:411:26: got restricted __le16
[addressable] [usertype] sample

This is a cosmetic-type patch since it does not alter code behaviour.
The le16 is going into a 16bit buf element, and is labelled as IIO_LE in the
channel buffer definition.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/imu/bmi160/bmi160_core.c

index 5fb571d0315377c05be3ba9951fc07a5ecd411ee..c9e319bff58b314f626797f9dbf36339eb76be04 100644 (file)
@@ -385,7 +385,8 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
        struct iio_poll_func *pf = p;
        struct iio_dev *indio_dev = pf->indio_dev;
        struct bmi160_data *data = iio_priv(indio_dev);
-       s16 buf[16]; /* 3 sens x 3 axis x s16 + 3 x s16 pad + 4 x s16 tstamp */
+       __le16 buf[16];
+       /* 3 sens x 3 axis x __le16 + 3 x __le16 pad + 4 x __le16 tstamp */
        int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L;
        __le16 sample;