public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: rc5t583: Fix off-by-one valid range checking for selector
@ 2012-04-04 14:38 Axel Lin
  2012-04-05  9:48 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-04-04 14:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Laxman Dewangan, Liam Girdwood, Mark Brown

The valid selector should be 0 ... nsteps-1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/rc5t583-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c
index cac8a2a..dc9ebb9 100644
--- a/drivers/regulator/rc5t583-regulator.c
+++ b/drivers/regulator/rc5t583-regulator.c
@@ -131,7 +131,7 @@ static int rc5t583_set_voltage_sel(struct regulator_dev *rdev,
 	struct rc5t583_regulator *reg = rdev_get_drvdata(rdev);
 	struct rc5t583_regulator_info *ri = reg->reg_info;
 	int ret;
-	if (selector > ri->nsteps) {
+	if (selector >= ri->nsteps) {
 		dev_err(&rdev->dev, "Invalid selector 0x%02x\n", selector);
 		return -EINVAL;
 	}
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-05  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-04 14:38 [PATCH] regulator: rc5t583: Fix off-by-one valid range checking for selector Axel Lin
2012-04-05  9:48 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox