Re: [tip: objtool/urgent] objtool, pwm: mediatek: Prevent theoretical divide-by-zero in pwm_mediatek_config()
From: Uwe Kleine-König
Date: Fri Mar 28 2025 - 06:25:06 EST
Hello Ingo,
On Thu, Mar 27, 2025 at 10:21:51PM +0100, Ingo Molnar wrote:
>
> * Uwe Kleine-König <ukleinek@xxxxxxxxxx> wrote:
>
> > > > > Cc: "Uwe Kleine-König" <ukleinek@xxxxxxxxxx> (maintainer:PWM SUBSYSTEM)
> > > > > Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> > > > > Link: https://lore.kernel.org/r/fb56444939325cc173e752ba199abd7aeae3bf12.1742852847.git.jpoimboe@xxxxxxxxxx
> > >
> > > I've also tentatively added your Acked-by, if that's OK with you.
> >
> > The patch is OK.
>
> Thanks!
>
> > [...] Iff you can convince me that it should go via tip, it's fine
> > for me.
>
> I wanted to collect all the objtool fixes for CONFIG_OBJTOOL_WERROR=y
Regarding "all": Taking a quick look, I wonder if
drivers/pwm/pwm-fsl-ftm.c is also affected. Given I cannot reproduce the
warning for the pwm-mediatek driver, I can only guess. This driver
does:
static unsigned int fsl_pwm_ticks_to_ns(struct fsl_pwm_chip *fpc,
unsigned int ticks)
{
unsigned long rate;
unsigned long long exval;
rate = clk_get_rate(fpc->clk[fpc->period.clk_select]);
exval = ticks;
exval *= 1000000000UL;
do_div(exval, rate >> fpc->period.clk_ps);
return exval;
}
and doesn't depend on HAVE_CLK. So similar to the pwm-mediatek driver
there are configurations where clk_get_rate() returns 0.
Assuming this is indeed a problem, I wonder how many more offenders
there are and if CONFIG_OBJTOOL_WERROR is ready for prime time already.
> failures in a single place to not inconvenience randconfig CI testing
> efforts, so in that sense it would be nice to send this via the
> objtool/urgent tree, but I'll remove it if you insist.
I'm still in the process to determine my opinion on that.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature