summaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-05-27 17:14:36 +0200
committerTakashi Iwai <tiwai@suse.de>2014-05-27 17:34:27 +0200
commitf9503a68fb8a69fb654f79b8f06bd099c478aab2 (patch)
tree973497090eeec0ad42e8062f47cda1db0b23bb7f /sound/firewire/amdtp.c
parentALSA: firewire/bebob: Add a workaround for M-Audio special Firewire series (diff)
downloadlinux-f9503a68fb8a69fb654f79b8f06bd099c478aab2.tar.xz
linux-f9503a68fb8a69fb654f79b8f06bd099c478aab2.zip
ALSA: firewire-lib: Use ARRAY_SIZE() instead of sizeof() for correct loop limit
This commit fixes a big for loop count with array. The limitation of loop count should be calcurated with the number of elements in the array, not with the number of bytes. Aditionally, this commit apply the same declaration as a prototype in header for the array. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/amdtp.c')
-rw-r--r--sound/firewire/amdtp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index e573f253e39d..31dd1cfc79b3 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -107,7 +107,7 @@ const unsigned int amdtp_syt_intervals[CIP_SFC_COUNT] = {
};
EXPORT_SYMBOL(amdtp_syt_intervals);
-const unsigned int amdtp_rate_table[] = {
+const unsigned int amdtp_rate_table[CIP_SFC_COUNT] = {
[CIP_SFC_32000] = 32000,
[CIP_SFC_44100] = 44100,
[CIP_SFC_48000] = 48000,
@@ -198,7 +198,7 @@ void amdtp_stream_set_parameters(struct amdtp_stream *s,
WARN_ON(midi_channels > AMDTP_MAX_CHANNELS_FOR_MIDI))
return;
- for (sfc = 0; sfc < sizeof(amdtp_rate_table); ++sfc)
+ for (sfc = 0; sfc < ARRAY_SIZE(amdtp_rate_table); ++sfc)
if (amdtp_rate_table[sfc] == rate)
goto sfc_found;
WARN_ON(1);