* [PATCH] ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate()
@ 2025-07-29 2:00 Sergio Perez Gonzalez
2025-08-13 14:52 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Sergio Perez Gonzalez @ 2025-07-29 2:00 UTC (permalink / raw)
To: olivier.moysan, arnaud.pouliquen, lgirdwood, broonie, perex,
tiwai, mcoquelin.stm32, alexandre.torgue
Cc: Sergio Perez Gonzalez, linux-sound, linux-stm32, linux-arm-kernel,
linux-kernel
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()")
Link: https://scan7.scan.coverity.com/#/project-view/53936/11354?selectedIssue=1647702
Signed-off-by: Sergio Perez Gonzalez <sperezglz@gmail.com>
---
sound/soc/stm/stm32_i2s.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
index 0e489097d9c1..6ca21780f21d 100644
--- a/sound/soc/stm/stm32_i2s.c
+++ b/sound/soc/stm/stm32_i2s.c
@@ -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;
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate()
2025-07-29 2:00 [PATCH] ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate() Sergio Perez Gonzalez
@ 2025-08-13 14:52 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-08-13 14:52 UTC (permalink / raw)
To: olivier.moysan, arnaud.pouliquen, lgirdwood, perex, tiwai,
mcoquelin.stm32, alexandre.torgue, Sergio Perez Gonzalez
Cc: linux-sound, linux-stm32, linux-arm-kernel, linux-kernel
On Mon, 28 Jul 2025 20:00:49 -0600, Sergio Perez Gonzalez wrote:
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-13 14:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 2:00 [PATCH] ASoC: stm: stm32_i2s: Fix calc_clk_div() error handling in determine_rate() Sergio Perez Gonzalez
2025-08-13 14:52 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).