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

index 0c04b2bb7efbf7c6ada8ac0ccb972e22bfa799d9..63a0b182824f671a6747fbe340f956eb6c302502 100644 (file)
@@ -1445,7 +1445,9 @@ int adxl367_probe(struct device *dev, const struct adxl367_ops *ops,
        st->context = context;
        st->ops = ops;
 
-       mutex_init(&st->lock);
+       ret = devm_mutex_init(dev, &st->lock);
+       if (ret)
+               return ret;
 
        indio_dev->channels = adxl367_channels;
        indio_dev->num_channels = ARRAY_SIZE(adxl367_channels);