]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: accel: adxl372: Use devm-managed mutex initialization
authorSanjay Chitroda <sanjayembeddedse@gmail.com>
Fri, 17 Apr 2026 12:49:23 +0000 (18:19 +0530)
committerJonathan Cameron <jic23@kernel.org>
Mon, 27 Apr 2026 08:58:19 +0000 (09:58 +0100)
Use devm_mutex_init() to tie the mutex lifetime to the device and
improve debugging when CONFIG_DEBUG_MUTEXES is enabled.

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/adxl372.c

index 545a21e5a3084fb88b0a0555305dd37801812c8a..1a6ba94f54f4be8749dcdd208a68368061ce4e9b 100644 (file)
@@ -1299,7 +1299,9 @@ int adxl372_probe(struct device *dev, struct regmap *regmap,
        st->irq = irq;
        st->chip_info = chip_info;
 
-       mutex_init(&st->threshold_m);
+       ret = devm_mutex_init(dev, &st->threshold_m);
+       if (ret < 0)
+               return ret;
 
        indio_dev->channels = adxl372_channels;
        indio_dev->num_channels = ARRAY_SIZE(adxl372_channels);