diff options
author | Mark Brown <broonie@kernel.org> | 2016-06-20 13:53:32 +0100 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2016-08-19 23:08:44 -0400 |
commit | 44cdc9fa258bde621577ac36fcab6fd674f4bf98 (patch) | |
tree | 688960db6d8e0c7fc7a1fc94c0bcdddc36315406 /drivers/iio/adc/ad7266.c | |
parent | 94f93848624aea581967a37e462909b3b0e6f0cb (diff) |
iio:ad7266: Fix broken regulator error handling
[ Upstream commit 6b7f4e25f3309f106a5c7ff42c8231494cf285d3 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'drivers/iio/adc/ad7266.c')
-rw-r--r-- | drivers/iio/adc/ad7266.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c index 70f78c3062a7..26cd54b39e0d 100644 --- a/drivers/iio/adc/ad7266.c +++ b/drivers/iio/adc/ad7266.c @@ -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; |