Skip to contentSkip to conversation

ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate()

PATCH In review Sergio Perez Gonzalez 2 participants 2 messages Jul 29, 2025 – Aug 13, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate()

calc_clk_div() will only return a non-zero value (-EINVAL) in case of error. On the other hand, req->rate is an unsigned long. It seems quite odd that req->rate would be assigned a negative value, which is clearly not a rate, and success would be returned.

Reinstate previous logic, which would just return error.

Fixes afd529d74002 ("ASoC: stm: stm32_i2s: convert from round_rate() to determine_rate()")
---
 sound/soc/stm/stm32_i2s.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
sound/soc/stm/stm32_i2s.c +2 -5
index 0e489097d9c1..6ca21780f21d 100644
@@ -469,11 +469,8 @@ static int stm32_i2smclk_determine_rate(struct clk_hw *hw,
 	int ret;
 
 	ret = stm32_i2s_calc_clk_div(i2s, req->best_parent_rate, req->rate);
-	if (ret) {
-		req->rate = ret;
-
-		return 0;
-	}
+	if (ret)
+		return ret;
 
 	mclk->freq = req->best_parent_rate / i2s->divider;
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 8 lines · Sergio Perez Gonzalez

calc_clk_div() will only return a non-zero value (-EINVAL) in case of error. On the other hand, req->rate is an unsigned long. It seems quite odd that req->rate would be assigned a negative value, which is clearly not a rate, and success would be returned.

Reinstate previous logic, which would just return error.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate()

      commit: 0ebbab41fba1bae6ccd96c0eec17026700ac6534

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark