mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: dapm: add initialization for w_param_text pointer
@ 2017-10-10  9:20 Arnd Bergmann
  2017-10-10  9:20 ` [PATCH 2/2] ASoC: dapm: mark 'snd_soc_dapm_free_kcontrol' as static Arnd Bergmann
  2017-10-10  9:30 ` Applied "ASoC: dapm: add initialization for w_param_text pointer" " Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Arnd Bergmann @ 2017-10-10  9:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: Arnd Bergmann, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Charles Keepax, anish kumar, alsa-devel, linux-kernel

We now allocate the array conditionally, but we always pass
the pointer to the new snd_soc_dapm_free_kcontrol() function,
which introduces a warning for the case that it is not
initialized:

sound/soc/soc-dapm.c: In function 'snd_soc_dapm_new_pcm':
sound/soc/soc-dapm.c:3940:2: error: 'w_param_text' may be used uninitialized in this function [-Werror=maybe-uninitialized]

As snd_soc_dapm_free_kcontrol() is global, it doesn't get inlined
and gcc fails to notice that we don't actually access the array
in that case, so the code is actually safe. Adding an initialization
for the array pointer shuts up the warning.

Fixes: 19ad683abc85 ("ASoC: dapm: Avoid creating kcontrol for params")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 sound/soc/soc-dapm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index ceec185c871f..19babdae1a06 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3905,6 +3905,8 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
 			ret = -ENOMEM;
 			goto param_fail;
 		}
+	} else {
+		w_param_text = NULL;
 	}
 	dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name);
 
-- 
2.9.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-10  9:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10  9:20 [PATCH 1/2] ASoC: dapm: add initialization for w_param_text pointer Arnd Bergmann
2017-10-10  9:20 ` [PATCH 2/2] ASoC: dapm: mark 'snd_soc_dapm_free_kcontrol' as static Arnd Bergmann
2017-10-10  9:30   ` Applied "ASoC: dapm: mark 'snd_soc_dapm_free_kcontrol' as static" to the asoc tree Mark Brown
2017-10-10  9:30 ` Applied "ASoC: dapm: add initialization for w_param_text pointer" " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®