OSDN Git Service

ALSA: pcm: constify function local and read-only table
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 16 May 2017 23:48:18 +0000 (08:48 +0900)
committerTakashi Iwai <tiwai@suse.de>
Wed, 17 May 2017 05:25:26 +0000 (07:25 +0200)
In a function snd_pcm_hw_params_choose(), target parameters are arranged
into a table. Though each entry of this table is read-only, they don't
have const qualifier.

This commit adds the qualifier.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/pcm_lib.c

index af439e5..ab4b1d1 100644 (file)
@@ -1734,7 +1734,7 @@ EXPORT_SYMBOL(snd_pcm_hw_param_last);
 int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
                             struct snd_pcm_hw_params *params)
 {
-       static int vars[] = {
+       static const int vars[] = {
                SNDRV_PCM_HW_PARAM_ACCESS,
                SNDRV_PCM_HW_PARAM_FORMAT,
                SNDRV_PCM_HW_PARAM_SUBFORMAT,
@@ -1745,7 +1745,8 @@ int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
                SNDRV_PCM_HW_PARAM_TICK_TIME,
                -1
        };
-       int err, *v;
+       const int *v;
+       int err;
 
        for (v = vars; *v != -1; v++) {
                if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE)