diff options
author | Jitao Shi <jitao.shi@mediatek.com> | 2021-08-08 21:24:32 +0800 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2021-09-02 22:27:44 +0200 |
commit | 331e049dec64c2d269648a3ea4ea6aae8a54b4ac (patch) | |
tree | ba043dde61cc93e9de83767f64334d26fcae5d2b /drivers/dma-buf | |
parent | 888a623db5d025cc72cd2887bacc3cf3fad10b6f (diff) |
pwm: mtk-disp: Fix overflow in period and duty calculation
Current calculation for period and high_width may have 64-bit overflow.
state->period and rate are u64. rate * state->period will overflow.
clk_div = div_u64(rate * state->period, NSEC_PER_SEC)
period = div64_u64(rate * state->period, div);
high_width = div64_u64(rate * state->duty_cycle, div);
This patch is to resolve it by using mul_u64_u64_div_u64().
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/dma-buf')
0 files changed, 0 insertions, 0 deletions