* [PATCH linux-next] ASoC: wm_hubs: Silence reg_r and reg_l 'may be used uninitialized' warnings
@ 2013-03-10 16:58 Tim Gardner
2013-03-12 18:50 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Tim Gardner @ 2013-03-10 16:58 UTC (permalink / raw)
To: linux-kernel
Cc: Tim Gardner, Mark Brown, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, patches, alsa-devel
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
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: patches@opensource.wolfsonmicro.com
Cc: alsa-devel@alsa-project.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
sound/soc/codecs/wm_hubs.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 867ae97..f5d81b9 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)
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)
{
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
u16 dcs_reg, reg;
+ int ret = 0;
switch (hubs->dcs_readback_mode) {
case 2:
@@ -236,8 +237,9 @@ static void wm_hubs_read_dc_servo(struct snd_soc_codec *codec,
break;
default:
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)
WM8993_DCS_TRIG_STARTUP_1);
}
- wm_hubs_read_dc_servo(codec, ®_l, ®_r);
+ if (wm_hubs_read_dc_servo(codec, ®_l, ®_r) < 0)
+ return;
dev_dbg(codec->dev, "DCS input: %x %x\n", reg_l, reg_r);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next] ASoC: wm_hubs: Silence reg_r and reg_l 'may be used uninitialized' warnings
2013-03-10 16:58 [PATCH linux-next] ASoC: wm_hubs: Silence reg_r and reg_l 'may be used uninitialized' warnings Tim Gardner
@ 2013-03-12 18:50 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2013-03-12 18:50 UTC (permalink / raw)
To: Tim Gardner
Cc: linux-kernel, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
patches, alsa-devel
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
On Sun, Mar 10, 2013 at 10:58:21AM -0600, Tim Gardner wrote:
> 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.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-12 18:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-10 16:58 [PATCH linux-next] ASoC: wm_hubs: Silence reg_r and reg_l 'may be used uninitialized' warnings Tim Gardner
2013-03-12 18:50 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).