Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep
@ 2025-10-31 10:58 Remi Buisson via B4 Relay
  2025-10-31 12:47 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Remi Buisson via B4 Relay @ 2025-10-31 10:58 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: Jonathan Cameron, linux-iio, linux-kernel, Remi Buisson

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>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep
  2025-10-31 10:58 [PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep Remi Buisson via B4 Relay
@ 2025-10-31 12:47 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-10-31 12:47 UTC (permalink / raw)
  To: remi.buisson
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Jonathan Cameron, linux-iio, linux-kernel

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-31 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 10:58 [PATCH] iio: imu: inv_icm45600: Initializes inv_icm45600_buffer_postdisable sleep Remi Buisson via B4 Relay
2025-10-31 12:47 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox