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

Commit 81d0a6ae authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel



Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
parent adf6178a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -447,7 +447,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,


	difference = (new_selector - old_selector) * desc->step / 1000;
	difference = (new_selector - old_selector) * desc->step / 1000;
	if (difference > 0)
	if (difference > 0)
		return difference / ((val & 0x0f) + 1);
		return DIV_ROUND_UP(difference, (val & 0x0f) + 1);


	return 0;
	return 0;
}
}