diff mbox

ALSA: ppc/awacs: shut up maybe-uninitialized warning

Message ID 20160704150759.2909708-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann July 4, 2016, 3:07 p.m. UTC
The awacs sound driver produces a false-positive warning in ppc64_defconfig:

sound/ppc/awacs.c: In function 'snd_pmac_awacs_init':
include/sound/control.h:219:9: warning: 'master_vol' may be used uninitialized in this function [-Wmaybe-uninitialized]

I haven't come up with a good way to rewrite the code to avoid the
warning, so here is a bad one: I initialize the variable before
the conditionall initialization so gcc no longer has to worry about
it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/ppc/awacs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Takashi Iwai July 5, 2016, 6:37 a.m. UTC | #1
On Mon, 04 Jul 2016 17:07:45 +0200,
Arnd Bergmann wrote:
> 
> The awacs sound driver produces a false-positive warning in ppc64_defconfig:
> 
> sound/ppc/awacs.c: In function 'snd_pmac_awacs_init':
> include/sound/control.h:219:9: warning: 'master_vol' may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> I haven't come up with a good way to rewrite the code to avoid the
> warning, so here is a bad one: I initialize the variable before
> the conditionall initialization so gcc no longer has to worry about
> it.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied, thanks.


Takashi
diff mbox

Patch

diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 09da7b52bc2e..1468e4b7bf93 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -991,6 +991,7 @@  snd_pmac_awacs_init(struct snd_pmac *chip)
 		if (err < 0)
 			return err;
 	}
+	master_vol = NULL;
 	if (pm7500)
 		err = build_mixers(chip,
 				   ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500),