Commit 0ff80acd authored by Mark Brown's avatar Mark Brown Committed by Willy Tarreau

iio:ad7266: Fix broken regulator error handling

commit 6b7f4e25 upstream.

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>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent bb29eeb4
...@@ -406,7 +406,7 @@ static int ad7266_probe(struct spi_device *spi) ...@@ -406,7 +406,7 @@ static int ad7266_probe(struct spi_device *spi)
st = iio_priv(indio_dev); st = iio_priv(indio_dev);
st->reg = regulator_get(&spi->dev, "vref"); st->reg = regulator_get(&spi->dev, "vref");
if (!IS_ERR_OR_NULL(st->reg)) { if (!IS_ERR(st->reg)) {
ret = regulator_enable(st->reg); ret = regulator_enable(st->reg);
if (ret) if (ret)
goto error_put_reg; goto error_put_reg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment