]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: ad7124: use devm_mutex_init()
authorDavid Lechner <dlechner@baylibre.com>
Wed, 17 Sep 2025 15:22:30 +0000 (10:22 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 13 Oct 2025 07:37:23 +0000 (08:37 +0100)
Use devm_mutex_init() to initialize the mutex to handle automatically
freeing in debug builds.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7124.c

index b13a7824ae014f2acffe70e7c0d02cf572caf369..dff935360e6d193db3845e8e2e8594dd217759e9 100644 (file)
@@ -1486,7 +1486,10 @@ static int ad7124_setup(struct ad7124_state *st)
        st->adc_control &= ~AD7124_ADC_CONTROL_MODE;
        st->adc_control |= FIELD_PREP(AD7124_ADC_CONTROL_MODE, AD_SD_MODE_IDLE);
 
-       mutex_init(&st->cfgs_lock);
+       ret = devm_mutex_init(dev, &st->cfgs_lock);
+       if (ret)
+               return ret;
+
        INIT_KFIFO(st->live_cfgs_fifo);
        for (i = 0; i < st->num_channels; i++) {
                struct ad7124_channel_config *cfg = &st->channels[i].cfg;