ASoC: cs42l52: Catch no-match case in cs42l52_get_clk

In the case of no-match, return -EINVAL instead of 0.

Since we assign i to ret in the for loop, ret always less than
ARRAY_SIZE(clk_map_table). Thus remove the boundary checking for ret.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Axel Lin 2012-12-20 16:53:16 +08:00 committed by Mark Brown
parent a49f0d1ea3
commit 3271a4fc7d
1 changed files with 1 additions and 3 deletions

View File

@ -737,7 +737,7 @@ static const struct cs42l52_clk_para clk_map_table[] = {
static int cs42l52_get_clk(int mclk, int rate)
{
int i, ret = 0;
int i, ret = -EINVAL;
u_int mclk1, mclk2 = 0;
for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
@ -749,8 +749,6 @@ static int cs42l52_get_clk(int mclk, int rate)
}
}
}
if (ret > ARRAY_SIZE(clk_map_table))
return -EINVAL;
return ret;
}