RE: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()

Previous thread: [PATCH] hwmon: (ads7871) Fix ads7871_probe init path by Axel Lin on Sunday, August 22, 2010 - 7:25 am. (2 messages)

Next thread: [PATCH] firmware: fix request_firmware() error handling by Pekka Enberg on Sunday, August 22, 2010 - 8:09 am. (2 messages)
From: Axel Lin
Date: Sunday, August 22, 2010 - 7:38 am

val is used as array index of ri->voltages.
Thus the valid value range should be 0 .. ri->desc.n_voltages - 1.

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

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index 8cff141..facd439 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -133,7 +133,7 @@ static int tps6586x_ldo_get_voltage(struct regulator_dev *rdev)
 	mask = ((1 << ri->volt_nbits) - 1) << ri->volt_shift;
 	val = (val & mask) >> ri->volt_shift;
 
-	if (val > ri->desc.n_voltages)
+	if (val >= ri->desc.n_voltages)
 		BUG();
 
 	return ri->voltages[val] * 1000;
-- 
1.7.0.4



--

From: Axel Lin
Date: Sunday, August 22, 2010 - 7:42 am

The third parameter of tps6586x_set_bits() is the bit_mask,
thus we should use (1 << ri->go_bit) instead of ri->go_bit.

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

diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
index facd439..51237fb 100644
--- a/drivers/regulator/tps6586x-regulator.c
+++ b/drivers/regulator/tps6586x-regulator.c
@@ -150,7 +150,7 @@ static int tps6586x_dvm_set_voltage(struct regulator_dev *rdev,
 	if (ret)
 		return ret;
 
-	return tps6586x_set_bits(parent, ri->go_reg, ri->go_bit);
+	return tps6586x_set_bits(parent, ri->go_reg, 1 << ri->go_bit);
 }
 
 static int tps6586x_regulator_enable(struct regulator_dev *rdev)
-- 
1.7.0.4



--

From: Mark Brown
Date: Monday, August 23, 2010 - 3:02 am

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

but I'd be much happier if someone who actually has the hardware could
verify that this is OK.
--

From: Mike Rapoport
Date: Monday, August 23, 2010 - 3:09 am

I don't have the hardware handy at the moment.
Gary, can you please verify the fix?

-- 
Sincerely yours,
Mike.
--

From: Liam Girdwood
Date: Wednesday, August 25, 2010 - 2:53 am

Do we have any news on this testing ? I'd like to have these upstream
for rc3.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

--

From: Gary King
Date: Wednesday, August 25, 2010 - 8:58 am

Sorry, I must have missed the original e-mail.

I'll give it a try either later today or tomorrow, after I 
context-switch back to my dev system that uses the tps6586x driver.

- Gary

From: Gary King
Date: Thursday, August 26, 2010 - 2:25 pm

The patch seems fine.

- Gary
________________________________________
From: Liam Girdwood [lrg@slimlogic.co.uk]
Sent: Wednesday, August 25, 2010 2:53 AM
To: Mike Rapoport
Cc: Mark Brown; Gary King; Axel Lin; linux-kernel
Subject: Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()


Do we have any news on this testing ? I'd like to have these upstream
for rc3.

Thanks

Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

--

From: Liam Girdwood
Date: Friday, August 27, 2010 - 6:03 am

Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

--

From: Mark Brown
Date: Monday, August 23, 2010 - 3:01 am

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
--

Previous thread: [PATCH] hwmon: (ads7871) Fix ads7871_probe init path by Axel Lin on Sunday, August 22, 2010 - 7:25 am. (2 messages)

Next thread: [PATCH] firmware: fix request_firmware() error handling by Pekka Enberg on Sunday, August 22, 2010 - 8:09 am. (2 messages)