regulator: tps6586x-regulator - fix value range checking for val
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.
--- drivers/regulator/tps6586x-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/tps6586x-regulator.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.0.4
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.
--- drivers/regulator/tps6586x-regulator.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/tps6586x-regulator.c +1 -1
@@ -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)
Signature · 1 line
1.7.0.4
Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()
Quoted 4 lines · Axel Lin
The third parameter of
tps6586x_set_bits()is thebit_mask, thus we should use (1 <<ri->go_bit) instead ofri->go_bit.Signed-off-by Axel Lin <[email protected]>
but I'd be much happier if someone who actually has the hardware could verify that this is OK.
Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()
Quoted 10 lines · Mark Brown
Quoted 4 lines · Axel Lin
The third parameter of
tps6586x_set_bits()is thebit_mask, thus we should use (1 <<ri->go_bit) instead ofri->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?
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()
Quoted 7 lines · Mike Rapoport
Quoted 6 lines · Mark Brown
Quoted 4 lines · Axel Lin
The third parameter of
tps6586x_set_bits()is thebit_mask, thus we should use (1 <<ri->go_bit) instead ofri->go_bit.Signed-off-by Axel Lin <[email protected]>
Quoted 8 lines
Quoted 4 lines
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
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
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
Quoted 21 lines · Liam Girdwood
Quoted 7 lines · Mike Rapoport
Quoted 6 lines · Mark Brown
Quoted 4 lines · Axel Lin
The third parameter of
tps6586x_set_bits()is thebit_mask, thus we should use (1 <<ri->go_bit) instead ofri->go_bit.Signed-off-by Axel Lin <[email protected]>Quoted 8 lines
Quoted 4 lines
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.
Quoted 8 lines
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�
RE: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()
In reply to Liam GirdwoodThe 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()
Quoted 7 lines · Mike Rapoport
Quoted 6 lines · Mark Brown
Quoted 4 lines · Axel Lin
The third parameter of
tps6586x_set_bits()is thebit_mask, thus we should use (1 <<ri->go_bit) instead ofri->go_bit.Signed-off-by Axel Lin <[email protected]>
Quoted 8 lines
Quoted 4 lines
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
Liam Girdwood
AppliedRE: [PATCH 2/2] regulator: tps6586x-regulator - fix bit_mask parameter for tps6586x_set_bits()
Quoted 23 lines · Gary King
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 - fixbit_maskparameter fortps6586x_set_bits()Quoted 12 lines · Mike Rapoport
Quoted 10 lines · Mark Brown
Quoted 4 lines · Axel Lin
The third parameter of
tps6586x_set_bits()is thebit_mask, thus we should use (1 <<ri->go_bit) instead ofri->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.
Quoted 7 lines
Quoted 3 lines
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
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Quoted 4 lines · Axel Lin
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]>