Commit 1f5353e7 authored by Tim Gardner's avatar Tim Gardner Committed by Mark Brown

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: default avatarTim Gardner <tim.gardner@canonical.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent f6161aa1
...@@ -199,11 +199,12 @@ static void wm_hubs_dcs_cache_set(struct snd_soc_codec *codec, u16 dcs_cfg) ...@@ -199,11 +199,12 @@ static void wm_hubs_dcs_cache_set(struct snd_soc_codec *codec, u16 dcs_cfg)
list_add_tail(&cache->list, &hubs->dcs_cache); list_add_tail(&cache->list, &hubs->dcs_cache);
} }
static void wm_hubs_read_dc_servo(struct snd_soc_codec *codec, static int wm_hubs_read_dc_servo(struct snd_soc_codec *codec,
u16 *reg_l, u16 *reg_r) u16 *reg_l, u16 *reg_r)
{ {
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
u16 dcs_reg, reg; u16 dcs_reg, reg;
int ret = 0;
switch (hubs->dcs_readback_mode) { switch (hubs->dcs_readback_mode) {
case 2: case 2:
...@@ -236,8 +237,9 @@ static void wm_hubs_read_dc_servo(struct snd_soc_codec *codec, ...@@ -236,8 +237,9 @@ static void wm_hubs_read_dc_servo(struct snd_soc_codec *codec,
break; break;
default: default:
WARN(1, "Unknown DCS readback method\n"); WARN(1, "Unknown DCS readback method\n");
return; ret = -1;
} }
return ret;
} }
/* /*
...@@ -286,7 +288,8 @@ static void enable_dc_servo(struct snd_soc_codec *codec) ...@@ -286,7 +288,8 @@ static void enable_dc_servo(struct snd_soc_codec *codec)
WM8993_DCS_TRIG_STARTUP_1); WM8993_DCS_TRIG_STARTUP_1);
} }
wm_hubs_read_dc_servo(codec, &reg_l, &reg_r); if (wm_hubs_read_dc_servo(codec, &reg_l, &reg_r) < 0)
return;
dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r); dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment