1
0
Fork 0

ASoC: stm32: sai: fix less than zero comparison on unsigned int

Currently, the comparison of div < 0 is always false because div is
an unsigned int. Fix this by making div an int.

Detected by CoverityScan, CID#1475309 ("Unsigned compared against 0")

Fixes: 8307b2afd3 "(ASoC: stm32: sai: set sai as mclk clock provider")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
hifive-unleashed-5.1
Colin Ian King 2018-10-31 19:31:43 +00:00 committed by Mark Brown
parent 651022382c
commit 6b27e27729
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 1 additions and 2 deletions

View File

@ -336,8 +336,7 @@ static int stm32_sai_mclk_set_rate(struct clk_hw *hw, unsigned long rate,
{
struct stm32_sai_mclk_data *mclk = to_mclk_data(hw);
struct stm32_sai_sub_data *sai = mclk->sai_data;
unsigned int div;
int ret;
int div, ret;
div = stm32_sai_get_clk_div(sai, parent_rate, rate);
if (div < 0)