[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1471793510-13022-127-git-send-email-w@1wt.eu>
Date: Sun, 21 Aug 2016 17:30:56 +0200
From: Willy Tarreau <w@....eu>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Mark Brown <broonie@...nel.org>, Stable@...r.kernel.org,
Jonathan Cameron <jic23@...nel.org>, Willy Tarreau <w@....eu>
Subject: [PATCH 3.10 126/180] iio:ad7266: Fix broken regulator error handling
From: Mark Brown <broonie@...nel.org>
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@...nel.org>
Cc: <Stable@...r.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@...nel.org>
Signed-off-by: Willy Tarreau <w@....eu>
---
drivers/iio/adc/ad7266.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index c2744a7..d08f417 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -406,7 +406,7 @@ static int ad7266_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
st->reg = regulator_get(&spi->dev, "vref");
- if (!IS_ERR_OR_NULL(st->reg)) {
+ if (!IS_ERR(st->reg)) {
ret = regulator_enable(st->reg);
if (ret)
goto error_put_reg;
--
2.8.0.rc2.1.gbe9624a
Powered by blists - more mailing lists