diff options
author | Tushar Behera <tushar.behera@linaro.org> | 2011-06-20 23:38:59 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-07-08 14:14:57 -0400 |
commit | dbb48e7c3db4871803fc990864e37917e413ccb2 (patch) | |
tree | c639d1f3b883907639c350701c669ddb7443dc53 /drivers/regulator/max8997.c | |
parent | e2cf3137aaa23faf2b8c1335671f1a0a0d90aab5 (diff) |
regulator: MAX8997: Fix for divide by zero error
Currently, ramp_delay variable is used uninitialzed in
max8997_set_voltage_ldobuck which gets called through
regulator_register calls.
To fix the problem, in max8997_pmic_probe, ramp_delay initialization
code is moved before calls to regulator_register.
Cc: Liam Girdwood <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/max8997.c')
-rw-r--r-- | drivers/regulator/max8997.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 10d5a1d9768e..0fc7b8c720d2 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -1124,6 +1124,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) | |||
1124 | 0x3f); | 1124 | 0x3f); |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | /* Misc Settings */ | ||
1128 | max8997->ramp_delay = 10; /* set 10mV/us, which is the default */ | ||
1129 | max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9); | ||
1130 | |||
1127 | for (i = 0; i < pdata->num_regulators; i++) { | 1131 | for (i = 0; i < pdata->num_regulators; i++) { |
1128 | const struct voltage_map_desc *desc; | 1132 | const struct voltage_map_desc *desc; |
1129 | int id = pdata->regulators[i].id; | 1133 | int id = pdata->regulators[i].id; |
@@ -1148,10 +1152,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) | |||
1148 | } | 1152 | } |
1149 | } | 1153 | } |
1150 | 1154 | ||
1151 | /* Misc Settings */ | ||
1152 | max8997->ramp_delay = 10; /* set 10mV/us, which is the default */ | ||
1153 | max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9); | ||
1154 | |||
1155 | return 0; | 1155 | return 0; |
1156 | err: | 1156 | err: |
1157 | for (i = 0; i < max8997->num_regulators; i++) | 1157 | for (i = 0; i < max8997->num_regulators; i++) |