From: Jonathan Cameron <jic23@kernel.org>
To: sayli karnik <karniksayli1995@gmail.com>,
outreachy-kernel@googlegroups.com
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v2] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
Date: Tue, 11 Oct 2016 19:43:01 +0100 [thread overview]
Message-ID: <27fa1ed2-54c8-df68-2b46-bdfd086d3bc3@kernel.org> (raw)
In-Reply-To: <20161011113721.GA26944@sayli-HP-15-Notebook-PC>
On 11/10/16 12:37, 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>
Applied to the togreg branch of iio.git - initially pushed out
as testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> Changes in v2:
> Moved comment above declaration of buf array
>
> 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;
>
>
prev parent reply other threads:[~2016-10-11 18:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-11 11:37 [PATCH v2] iio: bmi160_core: Fix sparse warning due to incorrect type in assignment sayli karnik
2016-10-11 18:43 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=27fa1ed2-54c8-df68-2b46-bdfd086d3bc3@kernel.org \
--to=jic23@kernel.org \
--cc=karniksayli1995@gmail.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=outreachy-kernel@googlegroups.com \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).