public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alberto Panizzo <maramaopercheseimorto@gmail.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Yong Shen <yong.shen@linaro.org>,
	Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
Date: Thu, 24 Feb 2011 10:13:07 +0100	[thread overview]
Message-ID: <1298538787.2454.24.camel@realization> (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.


Ok for me, but the next time give also the revision of the kernel
your patch is based on (Linus one, Liam one ..) that is the 
linus-2.6.38-rc6

Acked-by: Alberto Panizzo <maramaopercheseimorto@gmail.com>

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

-- 
Alberto!

        Be Persistent!
                - Greg Kroah-Hartman (FOSDEM 2010)


  reply	other threads:[~2011-02-24  9:13 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 [this message]
2011-02-24  9:39   ` Mark Brown
2011-02-24  9:37 ` Mark Brown
2011-02-25  8:55 ` Liam Girdwood

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=1298538787.2454.24.camel@realization \
    --to=maramaopercheseimorto@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox