Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1250871 > unrolled thread

[PATCH] adc: correctly check return value

Started byInsu Yun <wuninsu@gmail.com>
First post2015-10-19 18:10 +0200
Last post2015-10-19 21:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] adc: correctly check return value Insu Yun <wuninsu@gmail.com> - 2015-10-19 18:10 +0200
    Re: [PATCH] adc: correctly check return value Hartmut Knaack <knaack.h@gmx.de> - 2015-10-19 21:10 +0200

#1250871 — [PATCH] adc: correctly check return value

FromInsu Yun <wuninsu@gmail.com>
Date2015-10-19 18:10 +0200
Subject[PATCH] adc: correctly check return value
Message-ID<qllax-Yc-3@gated-at.bofh.it>
Since devm_regulator_get returns address or error, not NULL,
it needs to be checked with IS_ERR, not IS_ERR_OR_NULL.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 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 70f78c3..26cd54b 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;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1251017

FromHartmut Knaack <knaack.h@gmx.de>
Date2015-10-19 21:10 +0200
Message-ID<qlnYL-56E-41@gated-at.bofh.it>
In reply to#1250871
Insu Yun schrieb am 19.10.2015 um 18:08:
> Since devm_regulator_get returns address or error, not NULL,
> it needs to be checked with IS_ERR, not IS_ERR_OR_NULL.
> 

Actually, it does return NULL, if regulator support is disabled
(see [1]).

[1]http://lxr.free-electrons.com/source/include/linux/regulator/consumer.h#L286

> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
>  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 70f78c3..26cd54b 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;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web