linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] iio:ad7266: Fix broken regulator error handling
@ 2016-06-20 12:53 Mark Brown
  2016-06-20 12:53 ` [PATCH 2/3] iio:ad7266: Fix support for optional regulators Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mark Brown @ 2016-06-20 12:53 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron
  Cc: Linus Walleij, Hartmut Knaack, Peter Meerwald-Stadler, linux-iio,
	Mark Brown

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>
---
 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 21e19b60e2b9..835d45db258f 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;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-27  8:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-20 12:53 [PATCH 1/3] iio:ad7266: Fix broken regulator error handling Mark Brown
2016-06-20 12:53 ` [PATCH 2/3] iio:ad7266: Fix support for optional regulators Mark Brown
2016-06-26 16:40   ` Jonathan Cameron
2016-06-20 12:53 ` [PATCH 3/3] iio:ad7266: Fix probe deferral for vref Mark Brown
2016-06-26 16:41   ` Jonathan Cameron
2016-06-27  8:35     ` Linus Walleij
2016-06-26 16:40 ` [PATCH 1/3] iio:ad7266: Fix broken regulator error handling Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).