]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio:ad7266: Fix broken regulator error handling
authorMark Brown <broonie@kernel.org>
Mon, 20 Jun 2016 12:53:32 +0000 (13:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Jul 2016 16:55:50 +0000 (09:55 -0700)
commit 6b7f4e25f3309f106a5c7ff42c8231494cf285d3 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: Mark Brown <broonie@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/ad7266.c

index 70f78c3062a718f0d7267ee517a60387c8500fbe..26cd54b39e0d010a42703cea6f2fac11a55dc1f6 100644 (file)
@@ -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;