Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d88fc0b authored by Sangbeom Kim's avatar Sangbeom Kim Committed by Mark Brown
Browse files

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: default avatarSangbeom Kim <sbkim73@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 0bdc81e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -451,7 +451,7 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev,

	desc = reg_voltage_map[reg_id];

	if (old_sel < new_sel)
	if ((old_sel < new_sel) && s5m8767->ramp_delay)
		return DIV_ROUND_UP(desc->step * (new_sel - old_sel),
					s5m8767->ramp_delay * 1000);
	return 0;