]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable() sleep
authorRemi Buisson <remi.buisson@tdk.com>
Thu, 6 Nov 2025 15:31:07 +0000 (15:31 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 9 Nov 2025 16:52:52 +0000 (16:52 +0000)
The sleep variable in inv_icm45600_buffer_postdisable() could be used without
being assigned in case of error. It must be initialized to 0 by default.

Fixes: 06674a72cf7a ("iio: imu: inv_icm45600: add buffer support in iio devices")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-iio/aPi6Xw-ZoUkW76zR@stanley.mountain/
Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c

index 2efcc177f9d60a6a2509e448c0ddaf4b9e1fd755..2b9ea317385ceb680f013c4c1b2a6a74fbe5d7e7 100644 (file)
@@ -370,6 +370,7 @@ static int inv_icm45600_buffer_postdisable(struct iio_dev *indio_dev)
                return -EINVAL;
        }
 
+       sleep = 0;
        scoped_guard(mutex, &st->lock)
                ret = _inv_icm45600_buffer_postdisable(st, sensor, watermark, &sleep);