The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linaro-kernel@lists.linaro.org
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	broonie@kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	"open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK" 
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] regulator: core: Use IS_ERR_OR_NULL()
Date: Thu, 20 Aug 2015 15:26:41 +0200	[thread overview]
Message-ID: <1600359.hvYhnkmyof@wuerfel> (raw)
In-Reply-To: <3608f46110fb5b66e4e94f18a9af3283d4149fe8.1439794825.git.viresh.kumar@linaro.org>

On Monday 17 August 2015 12:30:58 Viresh Kumar wrote:
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 78387a6cbae5..55b49acfd9b3 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -1595,7 +1595,7 @@ static void _regulator_put(struct regulator *regulator)
>  {
>         struct regulator_dev *rdev;
>  
> -       if (regulator == NULL || IS_ERR(regulator))
> +       if (IS_ERR_OR_NULL(regulator))
>                 return;

The use of IS_ERR_OR_NULL is almost always a bug (as is the open-coded
equivalent).
Please try to find out why this is done here and add a comment
if it's actually correct, or fix it if not.

My guess is that it is not ok to pass an error pointer as the argument
of _regulator_put(), so maybe there should be WARN_ON()?

	Arnd

  parent reply	other threads:[~2015-08-20 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17  7:00 [PATCH] regulator: core: Use IS_ERR_OR_NULL() Viresh Kumar
2015-08-17 20:06 ` Mark Brown
2015-08-18  2:30   ` Viresh Kumar
2015-08-20 13:26 ` Arnd Bergmann [this message]
2015-08-20 15:52   ` Viresh Kumar

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=1600359.hvYhnkmyof@wuerfel \
    --to=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    /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