* [PATCH] adc: correctly check return value
@ 2015-10-19 16:08 Insu Yun
2015-10-19 19:05 ` Hartmut Knaack
0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2015-10-19 16:08 UTC (permalink / raw)
To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, linux-iio,
linux-kernel
Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] adc: correctly check return value
2015-10-19 16:08 [PATCH] adc: correctly check return value Insu Yun
@ 2015-10-19 19:05 ` Hartmut Knaack
0 siblings, 0 replies; 2+ messages in thread
From: Hartmut Knaack @ 2015-10-19 19:05 UTC (permalink / raw)
To: Insu Yun, lars, Michael.Hennerich, jic23, pmeerw, linux-iio,
linux-kernel
Cc: taesoo, yeongjin.jang, insu, changwoo
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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-19 19:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19 16:08 [PATCH] adc: correctly check return value Insu Yun
2015-10-19 19:05 ` Hartmut Knaack
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).