]> git.karo-electronics.de Git - linux-beck.git/commit
pwm: tegra: Avoid overflow when calculating duty cycle
authorHyong Bin Kim <hyongbink@nvidia.com>
Wed, 22 Jun 2016 11:47:21 +0000 (17:17 +0530)
committerThierry Reding <thierry.reding@gmail.com>
Mon, 11 Jul 2016 10:49:32 +0000 (12:49 +0200)
commitb979ed531468e9848d95a3b788dd8490927417e3
tree5d0c61c54f8ef8f1f1d12942a56d1bac91c6fc7a
parente0ee1a75f412cc9f3b16127742a30baf975ec51f
pwm: tegra: Avoid overflow when calculating duty cycle

duty_ns * (1 << PWM_DUTY_WIDTH) could overflow in integer calculation
when the PWM rate is low. Hence do all calculation on unsigned long long
to avoid overflow.

Signed-off-by: Hyong Bin Kim <hyongbink@nvidia.com>
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-tegra.c