When the variable `width` was introduced, the cast to u64 was dropped,
meaning that the multiplication would be done on 32bit numbers again, only
converting to u64 after the value had already overflowed. Reintroduce
the fix done in commit 533ad9dcda38 ("video: backlight: pwm: avoid integer
overflow in duty cycle calculation").

Fixes: 8300cebcd604 ("video: avoid build failure on veyron board")
Signed-off-by: Nora Schiffer <[email protected]>
---
 drivers/video/pwm_backlight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index 1470eaf4cab..3cfe74caa98 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -64,7 +64,7 @@ static int set_pwm(struct pwm_backlight_priv *priv)
        int ret;
 
        if (priv->period_ns) {
-               width = priv->period_ns * (priv->cur_level - priv->min_level);
+               width = (u64)priv->period_ns * (priv->cur_level - 
priv->min_level);
                duty_cycle = div_u64(width,
                                     (priv->max_level - priv->min_level));
                ret = pwm_set_config(priv->pwm, priv->channel, priv->period_ns,
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/

Reply via email to