Skip to content

Commit

Permalink
iio:ad7266: Fix broken regulator error handling
Browse files Browse the repository at this point in the history
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: Mark Brown <broonie@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Mark Brown authored and Jonathan Cameron committed Jun 26, 2016
1 parent 0c1f91b commit 6b7f4e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/ad7266.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6b7f4e2

Please sign in to comment.