regulator: MAX8997: Fix for divide by zero error
함명주
Acked-bySender : Tushar Behera<[email protected]>
Date : 2011-06-21 12:38 (GMT+09:00)
Quoted 7 lines
Currently,
ramp_delayvariable is used uninitialzed inmax8997_set_voltage_ldobuckwhich gets called throughregulator_registercalls.To fix the problem, in
max8997_pmic_probe,ramp_delayinitialization code is moved before calls toregulator_register.
Quoted 6 lines
Cc Liam GirdwoodCc Mark BrownCc MyungJoo HamCc Kyungmin ParkCc Samuel OrtizSigned-off-by Tushar Behera
Although I've never been reported such an issue, but I'm sure this will cause one any time. Thanks!
Quoted 28 lines
---
drivers/regulator/max8997.c| 8 ++++----1 files changed, 4 insertions(+), 4 deletions(-)drivers/regulator/max8997.c +4
-4@@ -1124,6 +1124,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) 0x3f); } +/* Misc Settings */ + max8997->ramp_delay =10 ;/* set 10mV/us, which is the default */ +max8997_write_reg (i2c,MAX8997_REG_BUCKRAMP , (0xf <<4 ) |0x9 ); +for (i =0 ; i < pdata->num_regulators; i++) {const struct voltage_map_desc *desc;int id = pdata->regulators[i].id;@@ -1148,10 +1152,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) } } -/* Misc Settings */ - max8997->ramp_delay =10 ;/* set 10mV/us, which is the default */ -max8997_write_reg (i2c,MAX8997_REG_BUCKRAMP , (0xf <<4 ) |0x9 ); -return 0 ;
Quoted 6 lines
err:
for (i = 0; i <max8997->num_regulators; i++)Signature · 1 line
1.7.4.1
MyungJoo Ham (함명주)
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: +82-10-6714-2858 / office: +82-31-279-8033�淸�{.n�+돴윯돪�+%듚�깁負쪐w��{.n�+돴쪐{깸G쳺��{ay����,j�f"톒쉹��묎�z_溫(�쉸듶줷"얎�m����G쳺�◀?솳鈺�&x�~뤳턨O뺞촾퇉v�^�m����띠�◀?뻀�
Quoted 9 lines · 함명주
Sender : Tushar Behera<[email protected]>
Date : 2011-06-21 12:38 (GMT+09:00)Quoted 7 lines
Currently,
ramp_delayvariable is used uninitialized inmax8997_set_voltage_ldobuckwhich gets called throughregulator_registercalls.To fix the problem, in
max8997_pmic_probe,ramp_delayinitialization code is moved before calls toregulator_register.
Quoted 8 lines
Quoted 6 lines
Cc Liam GirdwoodCc Mark BrownCc MyungJoo HamCc Kyungmin ParkCc Samuel OrtizSigned-off-by Tushar BeheraAlthough I've never been reported such an issue, but I'm sure this will cause one any time. Thanks!
One scenario:
Division by zero in kernel.
[<c00399c4>] (unwind_backtrace+0x0/0xe0) from [<c0162ed4>] (Ldiv0+0x8/0x10) [<c0162ed4>] (Ldiv0+0x8/0x10) from [<c018a1bc>] (max8997_set_voltage_ldobuck+0x198/0x1bc)
[<c018a1bc>] (max8997_set_voltage_ldobuck+0x198/0x1bc) from [<c0187ae8>] (_regulator_do_set_voltage+0x2c/0x1c4)
[<c0187ae8>] (_regulator_do_set_voltage+0x2c/0x1c4) from [<c0187eec>] (regulator_register+0x25c/0xe2c)
[<c0187eec>] (regulator_register+0x25c/0xe2c) from [<c02b9124>] (max8997_pmic_probe+0x5b8/0x69c)
Quoted 2 lines
Acked-by MyungJoo Ham<[email protected]>
Thanks.
Quoted 1 line
<snipped>
Quoted 42 lines
Quoted 28 lines
---
drivers/regulator/max8997.c| 8 ++++----1 files changed, 4 insertions(+), 4 deletions(-)drivers/regulator/max8997.c +4
-4@@ -1124,6 +1124,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) 0x3f); } +/* Misc Settings */ + max8997->ramp_delay =10 ;/* set 10mV/us, which is the default */ +max8997_write_reg (i2c,MAX8997_REG_BUCKRAMP , (0xf <<4 ) |0x9 ); +for (i =0 ; i< pdata->num_regulators; i++) {const struct voltage_map_desc *desc;int id = pdata->regulators[i].id;@@ -1148,10 +1152,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) } } -/* Misc Settings */ - max8997->ramp_delay =10 ;/* set 10mV/us, which is the default */ -max8997_write_reg (i2c,MAX8997_REG_BUCKRAMP , (0xf <<4 ) |0x9 ); -return 0 ;Quoted 6 lines
err:
for (i = 0; i<max8997->num_regulators; i++)Signature · 1 line
1.7.4.1MyungJoo Ham (함명주)
Mobile Software Platform Lab,
Digital Media and Communications (DMC) Business
Samsung Electronics
cell: +82-10-6714-2858 / office: +82-31-279-8033
Signature · 1 line
Tushar Behera