2010-08-22 14:37:51

by Axel Lin

[permalink] [raw]
Subject: [PATCH 1/2] regulator: tps6586x-regulator - fix value range checking for val

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 <[email protected]>
---
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



2010-08-22 14:42:19

by Axel Lin

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

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 <[email protected]>
---
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


2010-08-23 10:01:54

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: tps6586x-regulator - fix value range checking for val

On Sun, Aug 22, 2010 at 10:38:15PM +0800, Axel Lin wrote:
> 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 <[email protected]>

Acked-by: Mark Brown <[email protected]>

2010-08-23 10:02:54

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()

On Sun, Aug 22, 2010 at 10:42:42PM +0800, Axel Lin wrote:
> 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 <[email protected]>

Acked-by: Mark Brown <[email protected]>

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

2010-08-23 10:09:56

by Mike Rapoport

[permalink] [raw]
Subject: Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()

Mark Brown wrote:
> On Sun, Aug 22, 2010 at 10:42:42PM +0800, Axel Lin wrote:
>> 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 <[email protected]>
>
> Acked-by: Mark Brown <[email protected]>
>
> but I'd be much happier if someone who actually has the hardware could
> verify that this is OK.

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

--
Sincerely yours,
Mike.

2010-08-25 09:53:47

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()

On Mon, 2010-08-23 at 13:09 +0300, Mike Rapoport wrote:
> Mark Brown wrote:
> > On Sun, Aug 22, 2010 at 10:42:42PM +0800, Axel Lin wrote:
> >> 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 <[email protected]>
> >
> > Acked-by: Mark Brown <[email protected]>
> >
> > but I'd be much happier if someone who actually has the hardware could
> > verify that this is OK.
>
> I don't have the hardware handy at the moment.
> Gary, can you please verify the fix?
>

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

2010-08-25 16:04:09

by Gary King

[permalink] [raw]
Subject: Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()

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

On 08/25/2010 02:53 AM, Liam Girdwood wrote:
>
> On Mon, 2010-08-23 at 13:09 +0300, Mike Rapoport wrote:
> > Mark Brown wrote:
> > > On Sun, Aug 22, 2010 at 10:42:42PM +0800, Axel Lin wrote:
> > >> 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 <[email protected]>
> > >
> > > Acked-by: Mark Brown <[email protected]>
> > >
> > > but I'd be much happier if someone who actually has the hardware could
> > > verify that this is OK.
> >
> > I don't have the hardware handy at the moment.
> > Gary, can you please verify the fix?
> >
>
> 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
>
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?

2010-08-26 21:26:54

by Gary King

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

The patch seems fine.

- Gary
________________________________________
From: Liam Girdwood [[email protected]]
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()

On Mon, 2010-08-23 at 13:09 +0300, Mike Rapoport wrote:
> Mark Brown wrote:
> > On Sun, Aug 22, 2010 at 10:42:42PM +0800, Axel Lin wrote:
> >> 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 <[email protected]>
> >
> > Acked-by: Mark Brown <[email protected]>
> >
> > but I'd be much happier if someone who actually has the hardware could
> > verify that this is OK.
>
> I don't have the hardware handy at the moment.
> Gary, can you please verify the fix?
>

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

2010-08-27 13:03:51

by Liam Girdwood

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

On Thu, 2010-08-26 at 14:25 -0700, Gary King wrote:
> The patch seems fine.
>
> - Gary
> ________________________________________
> From: Liam Girdwood [[email protected]]
> 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()
>
> On Mon, 2010-08-23 at 13:09 +0300, Mike Rapoport wrote:
> > Mark Brown wrote:
> > > On Sun, Aug 22, 2010 at 10:42:42PM +0800, Axel Lin wrote:
> > >> 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 <[email protected]>
> > >
> > > Acked-by: Mark Brown <[email protected]>
> > >
> > > but I'd be much happier if someone who actually has the hardware could
> > > verify that this is OK.
> >
> > I don't have the hardware handy at the moment.
> > Gary, can you please verify the fix?
> >
>
> Do we have any news on this testing ? I'd like to have these upstream
> for rc3.
>

Applied.

Thanks

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