public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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