diff mbox series

[next] iio: accel: adxl367: Fix uninitialized variable handled

Message ID 20220224215149.146181-1-colin.i.king@gmail.com (mailing list archive)
State Rejected
Headers show
Series [next] iio: accel: adxl367: Fix uninitialized variable handled | expand

Commit Message

Colin Ian King Feb. 24, 2022, 9:51 p.m. UTC
Variable handle is not initialized leading to potential garbage
results with the or operations. Fix this by replacing the first
or operation to an assignment to ensure handled is initialized
correctly.

Fixes: cbab791c5e2a ("iio: accel: add ADXL367 driver")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/iio/accel/adxl367.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Feb. 26, 2022, 6:03 p.m. UTC | #1
On Thu, 24 Feb 2022 21:51:49 +0000
Colin Ian King <colin.i.king@gmail.com> wrote:

> Variable handle is not initialized leading to potential garbage
> results with the or operations. Fix this by replacing the first
> or operation to an assignment to ensure handled is initialized
> correctly.
> 
> Fixes: cbab791c5e2a ("iio: accel: add ADXL367 driver")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Hi Colin,

Nathan's patch hit my inbox first so I applied his but added
an additional Reported-by: for you to reflect you also reported it
via this patch.

Thanks

Jonathan

> ---
>  drivers/iio/accel/adxl367.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/adxl367.c b/drivers/iio/accel/adxl367.c
> index b452d74b1d4d..350a89b61179 100644
> --- a/drivers/iio/accel/adxl367.c
> +++ b/drivers/iio/accel/adxl367.c
> @@ -884,7 +884,7 @@ static irqreturn_t adxl367_irq_handler(int irq, void *private)
>  	if (ret)
>  		return IRQ_NONE;
>  
> -	handled |= adxl367_push_event(indio_dev, status);
> +	handled = adxl367_push_event(indio_dev, status);
>  	handled |= adxl367_push_fifo_data(indio_dev, status, fifo_entries);
>  
>  	return handled ? IRQ_HANDLED : IRQ_NONE;
diff mbox series

Patch

diff --git a/drivers/iio/accel/adxl367.c b/drivers/iio/accel/adxl367.c
index b452d74b1d4d..350a89b61179 100644
--- a/drivers/iio/accel/adxl367.c
+++ b/drivers/iio/accel/adxl367.c
@@ -884,7 +884,7 @@  static irqreturn_t adxl367_irq_handler(int irq, void *private)
 	if (ret)
 		return IRQ_NONE;
 
-	handled |= adxl367_push_event(indio_dev, status);
+	handled = adxl367_push_event(indio_dev, status);
 	handled |= adxl367_push_fifo_data(indio_dev, status, fifo_entries);
 
 	return handled ? IRQ_HANDLED : IRQ_NONE;