* [PATCH] ASoC: cs42l52: Catch no-match case in cs42l52_get_clk
@ 2012-12-20 8:53 Axel Lin
2012-12-24 16:02 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2012-12-20 8:53 UTC (permalink / raw)
To: Mark Brown; +Cc: Brian Austin, Georgi Vlaev, alsa-devel, Liam Girdwood
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>
---
sound/soc/codecs/cs42l52.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 99bb1c6..9811a54 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -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;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: cs42l52: Catch no-match case in cs42l52_get_clk
2012-12-20 8:53 [PATCH] ASoC: cs42l52: Catch no-match case in cs42l52_get_clk Axel Lin
@ 2012-12-24 16:02 ` Mark Brown
2012-12-24 20:48 ` Austin, Brian
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2012-12-24 16:02 UTC (permalink / raw)
To: Axel Lin; +Cc: Brian Austin, Georgi Vlaev, alsa-devel, Liam Girdwood
[-- Attachment #1.1: Type: text/plain, Size: 279 bytes --]
On Thu, Dec 20, 2012 at 04:53:16PM +0800, Axel Lin wrote:
> 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.
Applied, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: cs42l52: Catch no-match case in cs42l52_get_clk
2012-12-24 16:02 ` Mark Brown
@ 2012-12-24 20:48 ` Austin, Brian
0 siblings, 0 replies; 3+ messages in thread
From: Austin, Brian @ 2012-12-24 20:48 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel@alsa-project.org, Axel Lin, Georgi Vlaev,
Liam Girdwood
On Dec 24, 2012, at 10:02, "Mark Brown" <broonie@opensource.wolfsonmicro.com> wrote:
> On Thu, Dec 20, 2012 at 04:53:16PM +0800, Axel Lin wrote:
>> 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.
>
> Applied, thanks.
Sorry I did not see this new one. Thanks axel. FWIW
Acked-by: Brian Austin <brian.austin@cirrus.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-12-24 20:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-20 8:53 [PATCH] ASoC: cs42l52: Catch no-match case in cs42l52_get_clk Axel Lin
2012-12-24 16:02 ` Mark Brown
2012-12-24 20:48 ` Austin, Brian
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.