提交 07905298 编写于 作者: L Lucas Tanure 提交者: Takashi Iwai

ALSA: bebob: Use a signed return type for get_formation_index

The return type "unsigned int" was used by the get_formation_index function
despite of the aspect that it will eventually return a negative	error code.
So, change to signed int and get index by reference in the parameters.

Done with the help of Coccinelle.

[Fix the missing braces suggested by Julia Lawall -- tiwai]
Signed-off-by: NLucas Tanure <tanure@linux.com>
Reviewed-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 5a4ff9ec
...@@ -47,14 +47,16 @@ static const unsigned int bridgeco_freq_table[] = { ...@@ -47,14 +47,16 @@ static const unsigned int bridgeco_freq_table[] = {
[6] = 0x07, [6] = 0x07,
}; };
static unsigned int static int
get_formation_index(unsigned int rate) get_formation_index(unsigned int rate, unsigned int *index)
{ {
unsigned int i; unsigned int i;
for (i = 0; i < ARRAY_SIZE(snd_bebob_rate_table); i++) { for (i = 0; i < ARRAY_SIZE(snd_bebob_rate_table); i++) {
if (snd_bebob_rate_table[i] == rate) if (snd_bebob_rate_table[i] == rate) {
return i; *index = i;
return 0;
}
} }
return -EINVAL; return -EINVAL;
} }
...@@ -425,7 +427,9 @@ make_both_connections(struct snd_bebob *bebob, unsigned int rate) ...@@ -425,7 +427,9 @@ make_both_connections(struct snd_bebob *bebob, unsigned int rate)
goto end; goto end;
/* confirm params for both streams */ /* confirm params for both streams */
index = get_formation_index(rate); err = get_formation_index(rate, &index);
if (err < 0)
goto end;
pcm_channels = bebob->tx_stream_formations[index].pcm; pcm_channels = bebob->tx_stream_formations[index].pcm;
midi_channels = bebob->tx_stream_formations[index].midi; midi_channels = bebob->tx_stream_formations[index].midi;
err = amdtp_am824_set_parameters(&bebob->tx_stream, rate, err = amdtp_am824_set_parameters(&bebob->tx_stream, rate,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册