Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b7f4e25 authored by Mark Brown's avatar Mark Brown Committed by Jonathan Cameron
Browse files

iio:ad7266: Fix broken regulator error handling



All regulator_get() variants return either a pointer to a regulator or an
ERR_PTR() so testing for NULL makes no sense and may lead to bugs if we
use NULL as a valid regulator. Fix this by using IS_ERR() as expected.

Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 0c1f91b9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ static int ad7266_probe(struct spi_device *spi)
	st = iio_priv(indio_dev);

	st->reg = devm_regulator_get(&spi->dev, "vref");
	if (!IS_ERR_OR_NULL(st->reg)) {
	if (!IS_ERR(st->reg)) {
		ret = regulator_enable(st->reg);
		if (ret)
			return ret;