Re: [PATCH] iio: accel: bma400: Fix smatch warning based on use of unintialized value.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 18 Sep 2022 20:05:48 +0530
Jagath Jog J <jagathjog1996@xxxxxxxxx> 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@xxxxxxxxxx> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> >
> > 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@xxxxxxxxxx>
> > Cc: Jagath Jog J <jagathjog1996@xxxxxxxxx>
> > Cc: Alexander Potapenko <glider@xxxxxxxxxx>
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> > ---
> >  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
> >  




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux