Re: [tip: objtool/urgent] objtool, pwm: mediatek: Prevent theoretical divide-by-zero in pwm_mediatek_config()
From: Uwe Kleine-König
Date: Wed Mar 26 2025 - 06:36:16 EST
[I forgot a comma in the original post and so the list of Cc: was
broken. Here comes a resend, sorry to everyone who get the mail twice
now. If you reply, please do so on this copy to not continue using the
broken address.]
Hello,
On Tue, Mar 25, 2025 at 08:34:51AM +0000, tip-bot2 for Josh Poimboeuf wrote:
> The following commit has been merged into the objtool/urgent branch of tip:
>
> Commit-ID: 2becbc66a151500636046503f541255af6acf4fa
> Gitweb: https://git.kernel.org/tip/2becbc66a151500636046503f541255af6acf4fa
> Author: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> AuthorDate: Mon, 24 Mar 2025 14:56:11 -07:00
> Committer: Ingo Molnar <mingo@xxxxxxxxxx>
> CommitterDate: Tue, 25 Mar 2025 09:20:32 +01:00
I wonder a bit about procedures here. While I like that warnings that
pop up in drivers/pwm (and elsewhere) are cared for, I think that the
sensible way to change warning related settings is to make it hard to
enable them first (harder than "depends on !COMPILE_TEST" "To avoid
breaking bots too badly") and then work on the identified problems
before warning broadly. The way chosen here instead seems to be enabling
the warning immediately and then post fixes to the warnings and merge
them without respective maintainer feedback in less than 12 hours.
> objtool, pwm: mediatek: Prevent theoretical divide-by-zero in pwm_mediatek_config()
>
> With CONFIG_COMPILE_TEST && !CONFIG_CLK, pwm_mediatek_config() has a
> divide-by-zero in the following line:
>
> do_div(resolution, clk_get_rate(pc->clk_pwms[pwm->hwpwm]));
>
> due to the fact that the !CONFIG_CLK version of clk_get_rate() returns
> zero.
>
> This is presumably just a theoretical problem: COMPILE_TEST overrides
> the dependency on RALINK which would select COMMON_CLK. Regardless it's
RALINK and ARCH_MEDIATEK. The latter enables COMMON_CLK as it depends on
ARM or ARM64 which both select COMMON_CLK.
> a good idea to check for the error explicitly to avoid divide-by-zero.
>
> Fixes the following warning:
>
> drivers/pwm/pwm-mediatek.o: warning: objtool: .text: unexpected end of section
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Fixes: caf065f8fd58 ("pwm: Add MediaTek PWM support")
would be nice.
> 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 fail to reproduce the warning here for an x86_64 build on
1e26c5e28ca5. I have:
$ grep -E 'CONFIG_(CLK|PWM_MEDIATEK|OBJTOOL_WERROR)\>' .config
CONFIG_PWM_MEDIATEK=m
CONFIG_OBJTOOL_WERROR=y
and the build works fine for me and there is no warning about
drivers/pwm/pwm-mediatek.o. What am I missing?
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature