summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Alencar <rodrigo.alencar@analog.com>2026-02-16 20:10:49 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2026-02-24 00:00:57 +0300
commit5603a07af9f171b8402e839537698f0ecff4796b (patch)
treecddf655ad3c5aa835e0352d616462d8613e096f6
parentd9eece6f39c64b958e590686781e2aa16d7d6ae4 (diff)
downloadlinux-5603a07af9f171b8402e839537698f0ecff4796b.tar.xz
iio: amplifiers: ad8366: use devm_mutex_init() and drop mutex_init()
Adopt proper mutex lifecycle with devm_mutex_init(), replacing mutex_init(). Mutex init is moved up (before regulator init), so that goto statement in the error path is avoided (which will be cleaned up later). Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r--drivers/iio/amplifiers/ad8366.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index 677d02f4f075..6466f3eb6bbc 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -259,6 +259,10 @@ static int ad8366_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
+ ret = devm_mutex_init(dev, &st->lock);
+ if (ret)
+ return ret;
+
st->reg = devm_regulator_get(&spi->dev, "vcc");
if (!IS_ERR(st->reg)) {
ret = regulator_enable(st->reg);
@@ -267,7 +271,6 @@ static int ad8366_probe(struct spi_device *spi)
}
spi_set_drvdata(spi, indio_dev);
- mutex_init(&st->lock);
st->spi = spi;
st->type = spi_get_device_id(spi)->driver_data;