summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2022-11-16 00:12:39 +0000
committerTakashi Iwai <tiwai@suse.de>2022-11-16 12:54:41 +0100
commit3827597a89f85de0e136c67bf38677f2b2fda566 (patch)
tree30ac956a72c9b3a12e416614cc858851e3fe0561 /sound/core
parentcc26516374065a34e10c9a8bf3e940e42cd96e2a (diff)
downloadlinux-3827597a89f85de0e136c67bf38677f2b2fda566.tar.bz2
ALSA: pcm: avoid nused-but-set-variable warning
It will indicate below warning if W=1 was added and CONFIG_SND_DEBUG was not set. This patch adds __maybe_unused and avoid it. ${LINUX}/sound/core/pcm_native.c: In function 'constrain_mask_params': ${LINUX}/sound/core/pcm_native.c:291:25: error: variable 'old_mask' set but not used [-Werror=unused-but-set-variable] 291 | struct snd_mask old_mask; | ^~~~~~~~ ${LINUX}/sound/core/pcm_native.c: In function 'constrain_interval_params': ${LINUX}/sound/core/pcm_native.c:327:29: error: variable 'old_interval' set but not used [-Werror=unused-but-set-variable] 327 | struct snd_interval old_interval; | ^~~~~~~~~~~~ ${LINUX}/sound/core/pcm_native.c: In function 'constrain_params_by_rules': ${LINUX}/sound/core/pcm_native.c:368:29: error: variable 'old_interval' set but not used [-Werror=unused-but-set-variable] 368 | struct snd_interval old_interval; | ^~~~~~~~~~~~ ${LINUX}/sound/core/pcm_native.c:367:25: error: variable 'old_mask' set but not used [-Werror=unused-but-set-variable] 367 | struct snd_mask old_mask; | ^~~~~~~~ ${LINUX}/sound/core/pcm_native.c: In function 'snd_pcm_hw_params_choose': ${LINUX}/sound/core/pcm_native.c:652:29: error: variable 'old_interval' set but not used [-Werror=unused-but-set-variable] 652 | struct snd_interval old_interval; | ^~~~~~~~~~~~ ${LINUX}/sound/core/pcm_native.c:651:25: error: variable 'old_mask' set but not used [-Werror=unused-but-set-variable] 651 | struct snd_mask old_mask; | ^~~~~~~~ cc1: all warnings being treated as errors make[3]: *** [${LINUX}/scripts/Makefile.build:250: sound/core/pcm_native.o] error 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Tested-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/874juzg3kd.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm_native.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 33769ca78cc8..ba6e44d02faa 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -288,7 +288,7 @@ static int constrain_mask_params(struct snd_pcm_substream *substream,
&substream->runtime->hw_constraints;
struct snd_mask *m;
unsigned int k;
- struct snd_mask old_mask;
+ struct snd_mask old_mask __maybe_unused;
int changed;
for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) {
@@ -324,7 +324,7 @@ static int constrain_interval_params(struct snd_pcm_substream *substream,
&substream->runtime->hw_constraints;
struct snd_interval *i;
unsigned int k;
- struct snd_interval old_interval;
+ struct snd_interval old_interval __maybe_unused;
int changed;
for (k = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) {
@@ -364,8 +364,8 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
unsigned int stamp;
struct snd_pcm_hw_rule *r;
unsigned int d;
- struct snd_mask old_mask;
- struct snd_interval old_interval;
+ struct snd_mask old_mask __maybe_unused;
+ struct snd_interval old_interval __maybe_unused;
bool again;
int changed, err = 0;
@@ -648,8 +648,8 @@ static int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm,
-1
};
const int *v;
- struct snd_mask old_mask;
- struct snd_interval old_interval;
+ struct snd_mask old_mask __maybe_unused;
+ struct snd_interval old_interval __maybe_unused;
int changed;
for (v = vars; *v != -1; v++) {