[alsa-devel] [PATCH 2/2] ASoC: Fix 'may be used uninitialized' warnings

Fabio Estevam festevam at gmail.com
Mon Dec 24 18:55:38 CET 2012

From: Fabio Estevam <fabio.estevam at freescale.com>

Fix the following build warnings:

sound/soc/codecs/wm_hubs.c: In function 'hp_event':
sound/soc/codecs/wm_hubs.c:321:11: warning: 'reg_r' may be used uninitialized in this function [-Wuninitialized]
sound/soc/codecs/wm_hubs.c:251:13: note: 'reg_r' was declared here
sound/soc/codecs/wm_hubs.c:322:11: warning: 'reg_l' may be used uninitialized in this function [-Wuninitialized]
sound/soc/codecs/wm_hubs.c:251:6: note: 'reg_l' was declared here

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
 sound/soc/codecs/wm_hubs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 867ae97..a2ea687 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -248,7 +248,7 @@ static void enable_dc_servo(struct snd_soc_codec *codec)
 	struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
 	struct wm_hubs_dcs_cache *cache;
 	s8 offset;
-	u16 reg_l, reg_r, dcs_cfg, dcs_reg;
+	u16 reg_l = 0, reg_r = 0, dcs_cfg, dcs_reg;
 	switch (hubs->dcs_readback_mode) {
 	case 2:

More information about the Alsa-devel mailing list