]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ASoC: dapm: add initialization for w_param_text pointer
authorArnd Bergmann <arnd@arndb.de>
Tue, 10 Oct 2017 09:20:10 +0000 (11:20 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 10 Oct 2017 09:26:23 +0000 (10:26 +0100)
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c

index 44aed3383c62e4337276979bcfc6f7ae986221b5..12eb74d5f5c12c4f80f2b2ca3e2e59366c5a8fca 100644 (file)
@@ -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);