* [PATCH] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
@ 2016-10-07 17:24 sayli karnik
2016-10-08 13:39 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: sayli karnik @ 2016-10-07 17:24 UTC (permalink / raw)
To: outreachy-kernel
Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald-Stadler, 21cnbao
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>
---
drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index e0251b8..5355507 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
2016-10-07 17:24 [PATCH] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment sayli karnik
@ 2016-10-08 13:39 ` Greg KH
2016-10-09 7:11 ` sayli karnik
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2016-10-08 13:39 UTC (permalink / raw)
To: sayli karnik
Cc: outreachy-kernel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, 21cnbao
On Fri, Oct 07, 2016 at 10:54:31PM +0530, sayli karnik wrote:
> 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>
> ---
> drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
> index e0251b8..5355507 100644
> --- a/drivers/iio/imu/bmi160/bmi160_core.c
> +++ b/drivers/iio/imu/bmi160/bmi160_core.c
> @@ -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?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
2016-10-08 13:39 ` [Outreachy kernel] " Greg KH
@ 2016-10-09 7:11 ` sayli karnik
0 siblings, 0 replies; 3+ messages in thread
From: sayli karnik @ 2016-10-09 7:11 UTC (permalink / raw)
To: Greg KH
Cc: outreachy-kernel, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Barry Song
On Sat, Oct 8, 2016 at 7:09 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Fri, Oct 07, 2016 at 10:54:31PM +0530, sayli karnik wrote:
>> 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>
>> ---
>> drivers/iio/imu/bmi160/bmi160_core.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
>> index e0251b8..5355507 100644
>> --- a/drivers/iio/imu/bmi160/bmi160_core.c
>> +++ b/drivers/iio/imu/bmi160/bmi160_core.c
>> @@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-09 7:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07 17:24 [PATCH] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment sayli karnik
2016-10-08 13:39 ` [Outreachy kernel] " Greg KH
2016-10-09 7:11 ` sayli karnik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.