[PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep

Remi Buisson via B4 Relay posted 1 patch 3 months, 1 week ago
There is a newer version of this series
drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep
Posted by Remi Buisson via B4 Relay 3 months, 1 week ago
From: Remi Buisson <remi.buisson@tdk.com>

Fixes: 06674a72cf7a ("iio: imu: inv_icm45600: add buffer support in iio devices")
---
The sleep variable in inv_icm45600_buffer_postdisable could be used without being
assigned in case f error. It must be initialized to 0 by default.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
---
 drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c b/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
index 2efcc177f9d60a6a2509e448c0ddaf4b9e1fd755..bb8382feddc0fd882a6be2ce5e4fe77ab68f13fd 100644
--- a/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
+++ b/drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
@@ -357,7 +357,7 @@ static int inv_icm45600_buffer_postdisable(struct iio_dev *indio_dev)
 	struct device *dev = regmap_get_device(st->map);
 	unsigned int sensor;
 	unsigned int *watermark;
-	unsigned int sleep;
+	unsigned int sleep = 0;
 	int ret;
 
 	if (indio_dev == st->indio_gyro) {

---
base-commit: 70437bbd7529e9860fb7f0c92a89e0e6abaa994e
change-id: 20251031-icm45600_fix_buffer_sleep_init-8062f6e07f84

Best regards,
-- 
Remi Buisson <remi.buisson@tdk.com>
Re: [PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep
Posted by Andy Shevchenko 3 months, 1 week ago
On Fri, Oct 31, 2025 at 10:58:02AM +0000, Remi Buisson via B4 Relay wrote:
> From: Remi Buisson <remi.buisson@tdk.com>

Sorry, but you must write the commit message.

> Fixes: 06674a72cf7a ("iio: imu: inv_icm45600: add buffer support in iio devices")
> ---
> The sleep variable in inv_icm45600_buffer_postdisable could be used without being
> assigned in case f error. It must be initialized to 0 by default.

Why is this in the comment and not in the commit message? Also, can you spell
out the real compilation warning or so?

Otherwise the code might look okay, depending on the context. Again, usually
it's recommended to assign as late as possible to avoid subtle mistakes when
the same variable might be reused in the (future) code.

-- 
With Best Regards,
Andy Shevchenko