Skip to contentSkip to conversation

iio: bmi160_core: Fix sparse warning due to incorrect type in assignment

PATCH Superseded sayli karnik 2 participants 3 messages Oct 7, 2016 – Oct 9, 2016 IIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: bmi160_core: Fix sparse warning due to incorrect type in assignment

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.

---
 drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/imu/bmi160/bmi160_core.c +2 -1
index e0251b8..5355507 100644
@@ -398,7 +398,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;
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 26 lines · sayli karnik

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.

---
 drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/imu/bmi160/bmi160_core.c +0 -0
index e0251b8..5355507 100644

drivers/iio/imu/bmi160/bmi160_core.c static irqreturn_t bmi160_trigger_handler(int irq, void *p) · line 402

Quoted 6 lines
drivers/iio/imu/bmi160/bmi160_core.c +2 -1
@@ -398,7 +398,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 */

The comment doesn't make sense on the line below now does it?

#2 lore raw
Quoted 22 lines · Greg KH
Quoted 21 lines · sayli karnik

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.

---
 drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 14 lines

drivers/iio/imu/bmi160/bmi160_core.c static irqreturn_t bmi160_trigger_handler(int irq, void *p) · line 402

Quoted 11 lines
drivers/iio/imu/bmi160/bmi160_core.c +2 -1
index e0251b8..5355507 100644
@@ -398,7 +398,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 */

The comment doesn't make sense on the line below now does it?

Should I remove the comment entirely?

thanks,
sayli