[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221110145320.fwrdsymdfpdjyyga@pengutronix.de>
Date: Thu, 10 Nov 2022 15:53:20 +0100
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Steven Price <steven.price@....com>
Cc: Jonathan Hunter <jonathanh@...dia.com>,
Thierry Reding <thierry.reding@...il.com>,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
linux-tegra@...r.kernel.org
Subject: Re: [PATCH] pwm: tegra: Fix 32 bit build
Hello,
On Thu, Nov 10, 2022 at 11:45:48AM +0000, Steven Price wrote:
> The value of NSEC_PER_SEC << PWM_DUTY_WIDTH doesn't fix within a 32 bit
> integer causing a build warning/error (and the value truncated):
>
> drivers/pwm/pwm-tegra.c: In function ‘tegra_pwm_config’:
> drivers/pwm/pwm-tegra.c:148:53: error: result of ‘1000000000 << 8’ requires 39 bits to represent, but ‘long int’ only has 32 bits [-Werror=shift-overflow=]
> 148 | required_clk_rate = DIV_ROUND_UP_ULL(NSEC_PER_SEC << PWM_DUTY_WIDTH,
> | ^~
>
> Explicitly cast to a u64 to ensure the correct result.
Hmm, ideally this should have popped up earlier :-\
Anyhow:
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists