Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Rodrigo Alencar and committed by
Jonathan Cameron
5603a07a d9eece6f

+4 -1
+4 -1
drivers/iio/amplifiers/ad8366.c
··· 259 259 260 260 st = iio_priv(indio_dev); 261 261 262 + ret = devm_mutex_init(dev, &st->lock); 263 + if (ret) 264 + return ret; 265 + 262 266 st->reg = devm_regulator_get(&spi->dev, "vcc"); 263 267 if (!IS_ERR(st->reg)) { 264 268 ret = regulator_enable(st->reg); ··· 271 267 } 272 268 273 269 spi_set_drvdata(spi, indio_dev); 274 - mutex_init(&st->lock); 275 270 st->spi = spi; 276 271 st->type = spi_get_device_id(spi)->driver_data; 277 272