Ver código fonte

Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus

Mark Brown 9 anos atrás
pai
commit
b5db6c57c9
1 arquivos alterados com 10 adições e 0 exclusões
  1. 10 0
      sound/soc/soc-dapm.c

+ 10 - 0
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;
 	const struct snd_soc_pcm_stream *config = w->params + w->params_select;
 	struct snd_pcm_substream substream;
 	struct snd_pcm_substream substream;
 	struct snd_pcm_hw_params *params = NULL;
 	struct snd_pcm_hw_params *params = NULL;
+	struct snd_pcm_runtime *runtime = NULL;
 	u64 fmt;
 	u64 fmt;
 	int ret;
 	int ret;
 
 
@@ -3541,6 +3542,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
 
 
 	memset(&substream, 0, sizeof(substream));
 	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) {
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
 	case SND_SOC_DAPM_PRE_PMU:
 		substream.stream = SNDRV_PCM_STREAM_CAPTURE;
 		substream.stream = SNDRV_PCM_STREAM_CAPTURE;
@@ -3606,6 +3615,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
 	}
 	}
 
 
 out:
 out:
+	kfree(runtime);
 	kfree(params);
 	kfree(params);
 	return ret;
 	return ret;
 }
 }