Skip to content

Commit 0ebbab4

Browse files
sperezglzbroonie
authored andcommitted
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: afd529d ("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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dcb8290 commit 0ebbab4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

sound/soc/stm/stm32_i2s.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,8 @@ static int stm32_i2smclk_determine_rate(struct clk_hw *hw,
469469
int ret;
470470

471471
ret = stm32_i2s_calc_clk_div(i2s, req->best_parent_rate, req->rate);
472-
if (ret) {
473-
req->rate = ret;
474-
475-
return 0;
476-
}
472+
if (ret)
473+
return ret;
477474

478475
mclk->freq = req->best_parent_rate / i2s->divider;
479476

0 commit comments

Comments
 (0)