diff options
| author | Sangbeom Kim <sbkim73@samsung.com> | 2012-06-13 04:27:16 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-17 13:27:20 -0400 |
| commit | 9d88fc0b3503e80ab1a5c9fb3b3f074302f44b33 (patch) | |
| tree | 0577e89eed0cf9558b8a48cbebc56e56239054bf | |
| parent | 0bdc81e4e944781a2bcc971f9e3cf24ac7030939 (diff) | |
regulator: Fix the s5m8767a problem of the division by null
If ramp_delay is 0, delay value can be divided by zero.
This patch can fix the problem.
Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| -rw-r--r-- | drivers/regulator/s5m8767.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 290d6fc01029..9caadb482178 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
| @@ -451,7 +451,7 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev, | |||
| 451 | 451 | ||
| 452 | desc = reg_voltage_map[reg_id]; | 452 | desc = reg_voltage_map[reg_id]; |
| 453 | 453 | ||
| 454 | if (old_sel < new_sel) | 454 | if ((old_sel < new_sel) && s5m8767->ramp_delay) |
| 455 | return DIV_ROUND_UP(desc->step * (new_sel - old_sel), | 455 | return DIV_ROUND_UP(desc->step * (new_sel - old_sel), |
| 456 | s5m8767->ramp_delay * 1000); | 456 | s5m8767->ramp_delay * 1000); |
| 457 | return 0; | 457 | return 0; |
