[PATCH] ALSA: pcm: avoid nused-but-set-variable warning

Takashi Iwai tiwai at suse.de
Wed Nov 16 12:42:29 CET 2022


On Wed, 16 Nov 2022 01:12:39 +0100,
Kuninori Morimoto wrote:
> 
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> 
> 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 at renesas.com>

Thanks, applied now.


Takashi


More information about the Alsa-devel mailing list