* [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
@ 2011-02-23 22:45 Jesper Juhl
2011-02-24 9:13 ` Alberto Panizzo
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Jesper Juhl @ 2011-02-23 22:45 UTC (permalink / raw)
To: linux-kernel
Cc: Liam Girdwood, Mark Brown, Yong Shen, Sascha Hauer,
Alberto Panizzo
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];
}
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Plain text mails only, please.
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
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
2 siblings, 1 reply; 5+ messages in thread
From: Alberto Panizzo @ 2011-02-24 9:13 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-kernel, Liam Girdwood, Mark Brown, Yong Shen, Sascha Hauer
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)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
2011-02-24 9:13 ` Alberto Panizzo
@ 2011-02-24 9:39 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-02-24 9:39 UTC (permalink / raw)
To: Alberto Panizzo
Cc: Jesper Juhl, linux-kernel, Liam Girdwood, Yong Shen, Sascha Hauer
On Thu, Feb 24, 2011 at 10:13:07AM +0100, Alberto Panizzo wrote:
> 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
There is no need to do this for normal kernel submissions, it should be
obvious where the patch is going (either Linus' tree for urgent enough
fixes or whatever's in -next for the most part).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
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:37 ` Mark Brown
2011-02-25 8:55 ` Liam Girdwood
2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2011-02-24 9:37 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-kernel, Liam Girdwood, Yong Shen, Sascha Hauer,
Alberto Panizzo
On Wed, Feb 23, 2011 at 11:45:55PM +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>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] regulator, mc13xxx: Remove pointless test for unsigned less than zero
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:37 ` Mark Brown
@ 2011-02-25 8:55 ` Liam Girdwood
2 siblings, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2011-02-25 8:55 UTC (permalink / raw)
To: Jesper Juhl
Cc: linux-kernel, Mark Brown, Yong Shen, Sascha Hauer,
Alberto Panizzo
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-25 8:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox