mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
ALSA: echoaudio: simplify get_audio_levels
The loop optimizer seems to go astray here, and produces some warnings that don't seem valid. Still, the code can be simplified -- just clear the whole array at the beginning, and fill in whatever values are valid on the platform. Warnings before this change (GCC 8.2.0 ARM allmodconfig): In file included from ../sound/pci/echoaudio/gina24.c:115: ../sound/pci/echoaudio/echoaudio.c: In function 'snd_echo_vumeters_get': ../sound/pci/echoaudio/echoaudio_dsp.c:647:9: warning: iteration 1073741824 invokes undefined behavior [-Waggressive-loop-optimizations] In file included from ../sound/pci/echoaudio/layla24.c:112: ../sound/pci/echoaudio/echoaudio.c: In function 'snd_echo_vumeters_get': ../sound/pci/echoaudio/echoaudio_dsp.c:658:9: warning: iteration 1073741824 invokes undefined behavior [-Waggressive-loop-optimizations] ../sound/pci/echoaudio/echoaudio_dsp.c:647:9: warning: iteration 1073741824 invokes undefined behavior [-Waggressive-loop-optimizations] Signed-off-by: Olof Johansson <olof@lixom.net> Link: https://lore.kernel.org/r/20191207224953.25944-1-olof@lixom.net Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
4cc8d6505a
commit
c08f0a92f4
@ -635,36 +635,30 @@ This function assumes there are no more than 16 in/out busses or pipes
|
||||
Meters is an array [3][16][2] of long. */
|
||||
static void get_audio_meters(struct echoaudio *chip, long *meters)
|
||||
{
|
||||
int i, m, n;
|
||||
unsigned int i, m, n;
|
||||
|
||||
m = 0;
|
||||
n = 0;
|
||||
for (i = 0; i < num_busses_out(chip); i++, m++) {
|
||||
for (i = 0 ; i < 96; i++)
|
||||
meters[i] = 0;
|
||||
|
||||
for (m = 0, n = 0, i = 0; i < num_busses_out(chip); i++, m++) {
|
||||
meters[n++] = chip->comm_page->vu_meter[m];
|
||||
meters[n++] = chip->comm_page->peak_meter[m];
|
||||
}
|
||||
for (; n < 32; n++)
|
||||
meters[n] = 0;
|
||||
|
||||
#ifdef ECHOCARD_ECHO3G
|
||||
m = E3G_MAX_OUTPUTS; /* Skip unused meters */
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num_busses_in(chip); i++, m++) {
|
||||
for (n = 32, i = 0; i < num_busses_in(chip); i++, m++) {
|
||||
meters[n++] = chip->comm_page->vu_meter[m];
|
||||
meters[n++] = chip->comm_page->peak_meter[m];
|
||||
}
|
||||
for (; n < 64; n++)
|
||||
meters[n] = 0;
|
||||
|
||||
#ifdef ECHOCARD_HAS_VMIXER
|
||||
for (i = 0; i < num_pipes_out(chip); i++, m++) {
|
||||
for (n = 64, i = 0; i < num_pipes_out(chip); i++, m++) {
|
||||
meters[n++] = chip->comm_page->vu_meter[m];
|
||||
meters[n++] = chip->comm_page->peak_meter[m];
|
||||
}
|
||||
#endif
|
||||
for (; n < 96; n++)
|
||||
meters[n] = 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user