diff mbox series

clk: stm32: Fix a signedness issue in clk_stm32_composite_determine_rate()

Message ID d9a78453-9b40-48c1-830e-00751ba3ecb8@kili.mountain (mailing list archive)
State Accepted, archived
Headers show
Series clk: stm32: Fix a signedness issue in clk_stm32_composite_determine_rate() | expand

Commit Message

Dan Carpenter Oct. 10, 2023, 1:35 p.m. UTC
The divider_ro_round_rate() function could potentially return -EINVAL on
error but the error handling doesn't work because "rate" is unsigned.
It should be a type long.

Fixes: 06ed0fc0fbac ("clk: stm32: composite: Switch to determine_rate")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/clk/stm32/clk-stm32-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Maxime Ripard Oct. 12, 2023, 7:38 a.m. UTC | #1
On Tue, 10 Oct 2023 16:35:28 +0300, Dan Carpenter wrote:
> The divider_ro_round_rate() function could potentially return -EINVAL on
> error but the error handling doesn't work because "rate" is unsigned.
> It should be a type long.
> 
> Fixes: 06ed0fc0fbac ("clk: stm32: composite: Switch to determine_rate")
> 
> [ ... ]

Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime
Stephen Boyd Oct. 12, 2023, 11:47 p.m. UTC | #2
Quoting Dan Carpenter (2023-10-10 06:35:28)
> The divider_ro_round_rate() function could potentially return -EINVAL on
> error but the error handling doesn't work because "rate" is unsigned.
> It should be a type long.
> 
> Fixes: 06ed0fc0fbac ("clk: stm32: composite: Switch to determine_rate")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---

Applied to clk-fixes
diff mbox series

Patch

diff --git a/drivers/clk/stm32/clk-stm32-core.c b/drivers/clk/stm32/clk-stm32-core.c
index d5aa09e9fce4..067b918a8894 100644
--- a/drivers/clk/stm32/clk-stm32-core.c
+++ b/drivers/clk/stm32/clk-stm32-core.c
@@ -431,7 +431,7 @@  static int clk_stm32_composite_determine_rate(struct clk_hw *hw,
 {
 	struct clk_stm32_composite *composite = to_clk_stm32_composite(hw);
 	const struct stm32_div_cfg *divider;
-	unsigned long rate;
+	long rate;
 
 	if (composite->div_id == NO_STM32_DIV)
 		return 0;