From: Jonathan Cameron <jic23@kernel.org>
To: Jagath Jog J <jagathjog1996@gmail.com>
Cc: linux-iio@vger.kernel.org,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
Alexander Potapenko <glider@google.com>
Subject: Re: [PATCH] iio: accel: bma400: Fix smatch warning based on use of unintialized value.
Date: Sun, 18 Sep 2022 18:45:03 +0100 [thread overview]
Message-ID: <20220918184503.0db7e82a@jic23-huawei> (raw)
In-Reply-To: <CAM+2Eu+YCtCMKoWS9yJToEV__YB=enh=54b5thO+q4wGE80wZA@mail.gmail.com>
On Sun, 18 Sep 2022 20:05:48 +0530
Jagath Jog J <jagathjog1996@gmail.com> wrote:
> Hi Jonathan,
>
> Thank you for sending this patch.
> If you need a tag for this fix.
>
> Fixes: 961db2da159d ("iio: accel: bma400: Add support for single and
> double tap events")
Good point. I'm careful about fixes tags to stuff still not upstream
because they tend to be a little unstable. This should be fine.
I'll see if it's valid when I rebase the tree (hopefully in a few days
time).
Also helpful if you give an Acked-by!
Thanks,
Jonathan
>
> Thank you
> Jagath
>
> On Sat, Sep 17, 2022 at 6:44 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Only specific bits in this value are ever used and those are initialized,
> > but that is complex to reason about in a checker. Hence, initialize
> > the value to zero and avoid the complexity.
> >
> > Smatch warning:
> > drivers/iio/accel/bma400_core.c:1287 bma400_tap_event_en()
> > error: uninitialized symbol 'field_value'.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Jagath Jog J <jagathjog1996@gmail.com>
> > Cc: Alexander Potapenko <glider@google.com>
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > ---
> > drivers/iio/accel/bma400_core.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
> > index eceb1f8d338d..ad8fce3e08cd 100644
> > --- a/drivers/iio/accel/bma400_core.c
> > +++ b/drivers/iio/accel/bma400_core.c
> > @@ -1184,7 +1184,8 @@ static int bma400_activity_event_en(struct bma400_data *data,
> > enum iio_event_direction dir,
> > int state)
> > {
> > - int ret, reg, msk, value, field_value;
> > + int ret, reg, msk, value;
> > + int field_value = 0;
> >
> > switch (dir) {
> > case IIO_EV_DIR_RISING:
> > --
> > 2.37.2
> >
next prev parent reply other threads:[~2022-09-18 17:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-17 13:14 [PATCH] iio: accel: bma400: Fix smatch warning based on use of unintialized value Jonathan Cameron
2022-09-18 14:35 ` Jagath Jog J
2022-09-18 17:45 ` Jonathan Cameron [this message]
2022-09-19 6:10 ` Dan Carpenter
2022-09-19 15:41 ` Jonathan Cameron
2022-09-18 18:20 ` Jagath Jog J
2022-09-19 16:06 ` Jonathan Cameron
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=20220918184503.0db7e82a@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=dan.carpenter@oracle.com \
--cc=glider@google.com \
--cc=jagathjog1996@gmail.com \
--cc=linux-iio@vger.kernel.org \
/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