]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: accel: adxl380: Use devm-managed mutex initialization
authorSanjay Chitroda <sanjayembeddedse@gmail.com>
Fri, 17 Apr 2026 12:49:19 +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/adxl380.c

index e7bb32fbc47523cf1c312defd08262fb18c4f09b..7dca5523091fc4c6a3c3bf7e388d5d0d507bee19 100644 (file)
@@ -1967,7 +1967,9 @@ int adxl380_probe(struct device *dev, struct regmap *regmap,
        st->chip_info = chip_info;
        st->odr = ADXL380_ODR_DSM;
 
-       mutex_init(&st->lock);
+       ret = devm_mutex_init(dev, &st->lock);
+       if (ret)
+               return ret;
 
        indio_dev->channels = adxl380_channels;
        indio_dev->num_channels = ARRAY_SIZE(adxl380_channels);