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

index 8f90c58f41008a729e8442853703bb888580497e..a310f8e37e3dea0bb274050a582d39fd5f8aff00 100644 (file)
@@ -802,7 +802,9 @@ int adxl355_core_probe(struct device *dev, struct regmap *regmap,
        data->dev = dev;
        data->op_mode = ADXL355_STANDBY;
        data->chip_info = chip_info;
-       mutex_init(&data->lock);
+       ret = devm_mutex_init(dev, &data->lock);
+       if (ret)
+               return ret;
 
        indio_dev->name = chip_info->name;
        indio_dev->info = &adxl355_info;