From: Jonathan Cameron Date: Sat, 17 Sep 2022 13:14:01 +0000 (+0100) Subject: iio: accel: bma400: Fix smatch warning based on use of unintialized value. X-Git-Tag: v6.6.17~6447^2~25^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ee2a7058fea5d42087045250c667ac02f1a4e20;p=platform%2Fkernel%2Flinux-rpi.git iio: accel: bma400: Fix smatch warning based on use of unintialized value. 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 Cc: Jagath Jog J Cc: Alexander Potapenko Signed-off-by: Jonathan Cameron Acked-by: Jagath Jog J Fixes: 961db2da159d ("iio: accel: bma400: Add support for single and double tap events") Link: https://lore.kernel.org/r/20220917131401.2815486-1-jic23@kernel.org Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c index eceb1f8..ad8fce3 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: