aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTim Gardner <tim.gardner@canonical.com>2013-03-10 12:58:21 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-12 14:50:00 -0400
commit1f5353e765fe2a1168477bfe55e4dd7cdd96b477 (patch)
tree3aba70485940df2680169a5dec6f4f6b7f0419b6 /sound
parentf6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff)
ASoC: wm_hubs: Silence reg_r and reg_l 'may be used uninitialized' warnings
Return an error from wm_hubs_read_dc_servo() if hubs->dcs_readback_mode is not correctly initialized. You might as well bail out since nothing is likely to work correctly afterwards. 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 gcc version 4.6.3 Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm_hubs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 867ae97ddcec..f5d81b948759 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -199,11 +199,12 @@ static void wm_hubs_dcs_cache_set(struct snd_soc_codec *codec, u16 dcs_cfg)
199 list_add_tail(&cache->list, &hubs->dcs_cache); 199 list_add_tail(&cache->list, &hubs->dcs_cache);
200} 200}
201 201
202static void wm_hubs_read_dc_servo(struct snd_soc_codec *codec, 202static int wm_hubs_read_dc_servo(struct snd_soc_codec *codec,
203 u16 *reg_l, u16 *reg_r) 203 u16 *reg_l, u16 *reg_r)
204{ 204{
205 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); 205 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
206 u16 dcs_reg, reg; 206 u16 dcs_reg, reg;
207 int ret = 0;
207 208
208 switch (hubs->dcs_readback_mode) { 209 switch (hubs->dcs_readback_mode) {
209 case 2: 210 case 2:
@@ -236,8 +237,9 @@ static void wm_hubs_read_dc_servo(struct snd_soc_codec *codec,
236 break; 237 break;
237 default: 238 default:
238 WARN(1, "Unknown DCS readback method\n"); 239 WARN(1, "Unknown DCS readback method\n");
239 return; 240 ret = -1;
240 } 241 }
242 return ret;
241} 243}
242 244
243/* 245/*
@@ -286,7 +288,8 @@ static void enable_dc_servo(struct snd_soc_codec *codec)
286 WM8993_DCS_TRIG_STARTUP_1); 288 WM8993_DCS_TRIG_STARTUP_1);
287 } 289 }
288 290
289 wm_hubs_read_dc_servo(codec, &reg_l, &reg_r); 291 if (wm_hubs_read_dc_servo(codec, &reg_l, &reg_r) < 0)
292 return;
290 293
291 dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r); 294 dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
292 295