diff options
author | Lucas Tanure <tanure@linux.com> | 2016-01-25 16:30:23 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-01-26 05:38:53 -0500 |
commit | 07905298e4d5777eb58516cdc242f7ac1ca387a2 (patch) | |
tree | bd97b0dc55b987fa1b1b4d823ab95253020dfdf5 | |
parent | 5a4ff9ec8d6edd2ab1cfe8ce6a080d6e57cbea9a (diff) |
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: Lucas Tanure <tanure@linux.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/firewire/bebob/bebob_stream.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 926e5dcbb66a..5022c9b97ddf 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c | |||
@@ -47,14 +47,16 @@ static const unsigned int bridgeco_freq_table[] = { | |||
47 | [6] = 0x07, | 47 | [6] = 0x07, |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static unsigned int | 50 | static int |
51 | get_formation_index(unsigned int rate) | 51 | get_formation_index(unsigned int rate, unsigned int *index) |
52 | { | 52 | { |
53 | unsigned int i; | 53 | unsigned int i; |
54 | 54 | ||
55 | for (i = 0; i < ARRAY_SIZE(snd_bebob_rate_table); i++) { | 55 | for (i = 0; i < ARRAY_SIZE(snd_bebob_rate_table); i++) { |
56 | if (snd_bebob_rate_table[i] == rate) | 56 | if (snd_bebob_rate_table[i] == rate) { |
57 | return i; | 57 | *index = i; |
58 | return 0; | ||
59 | } | ||
58 | } | 60 | } |
59 | return -EINVAL; | 61 | return -EINVAL; |
60 | } | 62 | } |
@@ -425,7 +427,9 @@ make_both_connections(struct snd_bebob *bebob, unsigned int rate) | |||
425 | goto end; | 427 | goto end; |
426 | 428 | ||
427 | /* confirm params for both streams */ | 429 | /* confirm params for both streams */ |
428 | index = get_formation_index(rate); | 430 | err = get_formation_index(rate, &index); |
431 | if (err < 0) | ||
432 | goto end; | ||
429 | pcm_channels = bebob->tx_stream_formations[index].pcm; | 433 | pcm_channels = bebob->tx_stream_formations[index].pcm; |
430 | midi_channels = bebob->tx_stream_formations[index].midi; | 434 | midi_channels = bebob->tx_stream_formations[index].midi; |
431 | err = amdtp_am824_set_parameters(&bebob->tx_stream, rate, | 435 | err = amdtp_am824_set_parameters(&bebob->tx_stream, rate, |