* [PATCH] ASoC: WM8804: Workaround GCC uninitialised variable warning
@ 2010-10-01 8:32 Dimitris Papastamos
2010-10-02 11:19 ` Liam Girdwood
0 siblings, 1 reply; 2+ messages in thread
From: Dimitris Papastamos @ 2010-10-01 8:32 UTC (permalink / raw)
To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, patches
GCC 4.4.0 does not seem capable of working out that the variable is
never used unless it is initialised.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
sound/soc/codecs/wm8804.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 40e5067..e1fc722 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -392,13 +392,20 @@ static int wm8804_set_pll(struct snd_soc_dai *dai, int pll_id,
{
int ret;
struct snd_soc_codec *codec;
- struct pll_div pll_div = { 0 };
+ struct pll_div pll_div;
codec = dai->codec;
if (freq_in && freq_out) {
ret = pll_factors(&pll_div, freq_out, freq_in);
if (ret)
return ret;
+ } else {
+ /*
+ * Bodge GCC 4.4.0 uninitialised variable warning - it
+ * doesn't seem capable of working out that we exit if
+ * freq_in or freq_out is 0 before any of the uses.
+ */
+ memset(&pll_div, 0, sizeof pll_div);
}
/* power down the PLL before reprogramming it */
--
1.7.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: WM8804: Workaround GCC uninitialised variable warning
2010-10-01 8:32 [PATCH] ASoC: WM8804: Workaround GCC uninitialised variable warning Dimitris Papastamos
@ 2010-10-02 11:19 ` Liam Girdwood
0 siblings, 0 replies; 2+ messages in thread
From: Liam Girdwood @ 2010-10-02 11:19 UTC (permalink / raw)
To: Dimitris Papastamos; +Cc: alsa-devel, Mark Brown, patches
On Fri, 2010-10-01 at 09:32 +0100, Dimitris Papastamos wrote:
> GCC 4.4.0 does not seem capable of working out that the variable is
> never used unless it is initialised.
>
> Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
> ---
> sound/soc/codecs/wm8804.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
> index 40e5067..e1fc722 100644
> --- a/sound/soc/codecs/wm8804.c
> +++ b/sound/soc/codecs/wm8804.c
> @@ -392,13 +392,20 @@ static int wm8804_set_pll(struct snd_soc_dai *dai, int pll_id,
> {
> int ret;
> struct snd_soc_codec *codec;
> - struct pll_div pll_div = { 0 };
> + struct pll_div pll_div;
>
> codec = dai->codec;
> if (freq_in && freq_out) {
> ret = pll_factors(&pll_div, freq_out, freq_in);
> if (ret)
> return ret;
> + } else {
> + /*
> + * Bodge GCC 4.4.0 uninitialised variable warning - it
> + * doesn't seem capable of working out that we exit if
> + * freq_in or freq_out is 0 before any of the uses.
> + */
> + memset(&pll_div, 0, sizeof pll_div);
> }
>
> /* power down the PLL before reprogramming it */
Is it not possible to refactor your logic here to be more like
wm8753_set_pll() rather than this ugly workaround ?
Liam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-10-02 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 8:32 [PATCH] ASoC: WM8804: Workaround GCC uninitialised variable warning Dimitris Papastamos
2010-10-02 11:19 ` Liam Girdwood
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).