diff options
author | Josh Poimboeuf <jpoimboe@kernel.org> | 2025-04-01 13:28:59 +0300 |
---|---|---|
committer | Uwe Kleine-König <ukleinek@kernel.org> | 2025-04-02 19:31:42 +0300 |
commit | 7ca59947b5fcf94e7ea4029d1bd0f7c41500a161 (patch) | |
tree | 7942a44577c7aefa8b305bbe13b26d54b522e61a /drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | |
parent | 6df320abbb40654085d7258de33d78481e93ac8d (diff) | |
download | linux-7ca59947b5fcf94e7ea4029d1bd0f7c41500a161.tar.xz |
pwm: mediatek: Prevent divide-by-zero in pwm_mediatek_config()
With CONFIG_COMPILE_TEST && !CONFIG_HAVE_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_HAVE_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
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@kernel.org>
Link: https://lore.kernel.org/r/fb56444939325cc173e752ba199abd7aeae3bf12.1742852847.git.jpoimboe@kernel.org
[ukleinek: s/CONFIG_CLK/CONFIG_HAVE_CLK/]
Fixes: caf065f8fd58 ("pwm: Add MediaTek PWM support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/9e78a0796acba3435553ed7db1c7965dcffa6215.1743501688.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c')
0 files changed, 0 insertions, 0 deletions