iio: adc128s052: Fix the error handling path of 'adc128_probe()'

A successful 'regulator_enable()' call should be balanced by a
corresponding 'regulator_disable()' call in the error handling path of the
probe, as already done in the remove function.

Update the error handling path accordingly.

Fixes: 913b864686 ("iio: adc: Add TI ADC128S052")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/85189f1cfcf6f5f7b42d8730966f2a074b07b5f5.1629542160.git.christophe.jaillet@wanadoo.fr
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Christophe JAILLET 2021-08-21 12:37:24 +02:00 коммит произвёл Jonathan Cameron
Родитель 9909a395e9
Коммит bbcf40816b
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -171,7 +171,13 @@ static int adc128_probe(struct spi_device *spi)
mutex_init(&adc->lock);
ret = iio_device_register(indio_dev);
if (ret)
goto err_disable_regulator;
return 0;
err_disable_regulator:
regulator_disable(adc->reg);
return ret;
}