linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hartmut Knaack <knaack.h@gmx.de>
To: Insu Yun <wuninsu@gmail.com>,
	lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org,
	pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu,
	changwoo@gatech.edu
Subject: Re: [PATCH] adc: correctly check return value
Date: Mon, 19 Oct 2015 21:05:11 +0200	[thread overview]
Message-ID: <56253EE7.5050107@gmx.de> (raw)
In-Reply-To: <1445270931-24109-1-git-send-email-wuninsu@gmail.com>

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;
> 


      reply	other threads:[~2015-10-19 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 16:08 [PATCH] adc: correctly check return value Insu Yun
2015-10-19 19:05 ` Hartmut Knaack [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56253EE7.5050107@gmx.de \
    --to=knaack.h@gmx.de \
    --cc=Michael.Hennerich@analog.com \
    --cc=changwoo@gatech.edu \
    --cc=insu@gatech.edu \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=taesoo@gatech.edu \
    --cc=wuninsu@gmail.com \
    --cc=yeongjin.jang@gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).