All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@slimlogic.co.uk>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Yong Shen <yong.shen@linaro.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Alberto Panizzo <maramaopercheseimorto@gmail.com>
Subject: Re: [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
Date: Fri, 25 Feb 2011 08:55:13 +0000	[thread overview]
Message-ID: <1298624113.3363.0.camel@odin> (raw)
In-Reply-To: <alpine.LNX.2.00.1102232341030.28678@swampdragon.chaosbits.net>

On Wed, 2011-02-23 at 23:45 +0100, Jesper Juhl wrote:
> The variable 'val' is a 'unsigned int', so it can never be less than zero. 
> This fact makes the "val < 0" part of the test done in BUG_ON() in 
> mc13xxx_regulator_get_voltage() rather pointles since it can never have 
> any effect.
> This patch removes the pointless test.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  mc13xxx-regulator-core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c
> index f53d31b..2bb5de1 100644
> --- a/drivers/regulator/mc13xxx-regulator-core.c
> +++ b/drivers/regulator/mc13xxx-regulator-core.c
> @@ -174,7 +174,7 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev)
>  
>  	dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val);
>  
> -	BUG_ON(val < 0 || val > mc13xxx_regulators[id].desc.n_voltages);
> +	BUG_ON(val > mc13xxx_regulators[id].desc.n_voltages);
>  
>  	return mc13xxx_regulators[id].voltages[val];
>  }
> 

Applied.

Thanks

Liam



      parent reply	other threads:[~2011-02-25  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 22:45 [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero Jesper Juhl
2011-02-24  9:13 ` Alberto Panizzo
2011-02-24  9:39   ` Mark Brown
2011-02-24  9:37 ` Mark Brown
2011-02-25  8:55 ` Liam Girdwood [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=1298624113.3363.0.camel@odin \
    --to=lrg@slimlogic.co.uk \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maramaopercheseimorto@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=yong.shen@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.