diff options
author | Mark Brown <broonie@kernel.org> | 2016-08-24 20:05:18 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-24 20:05:18 +0200 |
commit | b5db6c57c9fb7068cf50e82c27886cc00b9cd78e (patch) | |
tree | b18ed42f82b3e6fe71c928662700503a23feabf5 | |
parent | Merge remote-tracking branch 'asoc/fix/core' into asoc-linus (diff) | |
parent | ASoC: dapm: Add a dummy snd_pcm_runtime to avoid NULL pointer access (diff) | |
download | linux-b5db6c57c9fb7068cf50e82c27886cc00b9cd78e.tar.xz linux-b5db6c57c9fb7068cf50e82c27886cc00b9cd78e.zip |
Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
-rw-r--r-- | sound/soc/soc-dapm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8698c26773b3..d908ff8f9755 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3493,6 +3493,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, const struct snd_soc_pcm_stream *config = w->params + w->params_select; struct snd_pcm_substream substream; struct snd_pcm_hw_params *params = NULL; + struct snd_pcm_runtime *runtime = NULL; u64 fmt; int ret; @@ -3541,6 +3542,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, memset(&substream, 0, sizeof(substream)); + /* Allocate a dummy snd_pcm_runtime for startup() and other ops() */ + runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); + if (!runtime) { + ret = -ENOMEM; + goto out; + } + substream.runtime = runtime; + switch (event) { case SND_SOC_DAPM_PRE_PMU: substream.stream = SNDRV_PCM_STREAM_CAPTURE; @@ -3606,6 +3615,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, } out: + kfree(runtime); kfree(params); return ret; } |