* [bug report] iio: imu: inv_icm45600: add buffer support in iio devices
@ 2025-10-22 11:05 Dan Carpenter
2025-10-31 11:06 ` Remi Buisson
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-10-22 11:05 UTC (permalink / raw)
To: Remi Buisson; +Cc: linux-iio
Hello Remi Buisson,
Commit 06674a72cf7a ("iio: imu: inv_icm45600: add buffer support in
iio devices") from Oct 7, 2025 (linux-next), leads to the following
Smatch static checker warning:
drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c:377 inv_icm45600_buffer_postdisable()
error: uninitialized symbol 'sleep'.
drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
354 static int inv_icm45600_buffer_postdisable(struct iio_dev *indio_dev)
355 {
356 struct inv_icm45600_state *st = iio_device_get_drvdata(indio_dev);
357 struct device *dev = regmap_get_device(st->map);
358 unsigned int sensor;
359 unsigned int *watermark;
360 unsigned int sleep;
361 int ret;
362
363 if (indio_dev == st->indio_gyro) {
364 sensor = INV_ICM45600_SENSOR_GYRO;
365 watermark = &st->fifo.watermark.gyro;
366 } else if (indio_dev == st->indio_accel) {
367 sensor = INV_ICM45600_SENSOR_ACCEL;
368 watermark = &st->fifo.watermark.accel;
369 } else {
370 return -EINVAL;
371 }
372
373 scoped_guard(mutex, &st->lock)
374 ret = _inv_icm45600_buffer_postdisable(st, sensor, watermark, &sleep);
375
376 /* Sleep required time. */
--> 377 if (sleep)
sleep is only set if _inv_icm45600_buffer_postdisable() succeeds.
378 msleep(sleep);
379
380 pm_runtime_put_autosuspend(dev);
381
382 return ret;
383 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: [bug report] iio: imu: inv_icm45600: add buffer support in iio devices
2025-10-22 11:05 [bug report] iio: imu: inv_icm45600: add buffer support in iio devices Dan Carpenter
@ 2025-10-31 11:06 ` Remi Buisson
0 siblings, 0 replies; 2+ messages in thread
From: Remi Buisson @ 2025-10-31 11:06 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-iio@vger.kernel.org
>
>
>From: Dan Carpenter <dan.carpenter@linaro.org>
>Sent: Wednesday, October 22, 2025 1:05 PM
>To: Remi Buisson <Remi.Buisson@tdk.com>
>Cc: linux-iio@vger.kernel.org
>Subject: [bug report] iio: imu: inv_icm45600: add buffer support in iio devices
>
>> Remi Buisson,
>
>Commit 06674a72cf7a ("iio: imu: inv_icm45600: add buffer support in
>iio devices") from Oct 7, 2025 (linux-next), leads to the following
>Smatch static checker warning:
>
> drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c:377 inv_icm45600_buffer_postdisable()
> error: uninitialized symbol 'sleep'.
>
>drivers/iio/imu/inv_icm45600/inv_icm45600_buffer.c
> 354 static int inv_icm45600_buffer_postdisable(struct iio_dev *indio_dev)
> 355 {
> 356 struct inv_icm45600_state *st = iio_device_get_drvdata(indio_dev);
> 357 struct device *dev = regmap_get_device(st->map);
> 358 unsigned int sensor;
> 359 unsigned int *watermark;
> 360 unsigned int sleep;
> 361 int ret;
> 362
> 363 if (indio_dev == st->indio_gyro) {
> 364 sensor = INV_ICM45600_SENSOR_GYRO;
> 365 watermark = &st->fifo.watermark.gyro;
> 366 } else if (indio_dev == st->indio_accel) {
> 367 sensor = INV_ICM45600_SENSOR_ACCEL;
> 368 watermark = &st->fifo.watermark.accel;
> 369 } else {
> 370 return -EINVAL;
> 371 }
> 372
> 373 scoped_guard(mutex, &st->lock)
> 374 ret = _inv_icm45600_buffer_postdisable(st, sensor, watermark, &sleep);
> 375
> 376 /* Sleep required time. */
>--> 377 if (sleep)
>
>sleep is only set if _inv_icm45600_buffer_postdisable() succeeds.
>
> 378 msleep(sleep);
> 379
> 380 pm_runtime_put_autosuspend(dev);
> 381
> 382 return ret;
> 383 }
>
>regards,
>dan carpenter
>
Thanks for reporting the issue!
Fixed in change-id: 20251031-icm45600_fix_buffer_sleep_init-8062f6e07f84
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-31 11:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 11:05 [bug report] iio: imu: inv_icm45600: add buffer support in iio devices Dan Carpenter
2025-10-31 11:06 ` Remi Buisson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox