ASoc: msm: Update platform drivers to correctly access audio_client

Update platform driver open function call to access
audio_client pointer only after allocation to avoid crash.

Signed-off-by: SathishKumar Mani <smani@codeaurora.org>
This commit is contained in:
SathishKumar Mani
2012-08-28 10:57:37 -07:00
committed by Iliyan Malchev
parent 9137e5bbac
commit 9f9c98e3ac
3 changed files with 3 additions and 4 deletions

View File

@@ -548,7 +548,6 @@ static int msm_compr_open(struct snd_pcm_substream *substream)
}
prtd = &compr->prtd;
prtd->substream = substream;
prtd->audio_client->perf_mode = false;
prtd->audio_client = q6asm_audio_client_alloc(
(app_cb)compr_event_handler, compr);
if (!prtd->audio_client) {
@@ -556,7 +555,7 @@ static int msm_compr_open(struct snd_pcm_substream *substream)
kfree(prtd);
return -ENOMEM;
}
prtd->audio_client->perf_mode = false;
pr_info("%s: session ID %d\n", __func__, prtd->audio_client->session);
prtd->session_id = prtd->audio_client->session;

View File

@@ -330,7 +330,6 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
return -ENOMEM;
}
prtd->substream = substream;
prtd->audio_client->perf_mode = false;
prtd->audio_client = q6asm_audio_client_alloc(
(app_cb)event_handler, prtd);
if (!prtd->audio_client) {
@@ -338,6 +337,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
kfree(prtd);
return -ENOMEM;
}
prtd->audio_client->perf_mode = false;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
runtime->hw = msm_pcm_hardware_playback;
ret = q6asm_open_write(prtd->audio_client,

View File

@@ -282,7 +282,6 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
}
runtime->hw = msm_pcm_hardware;
prtd->substream = substream;
prtd->audio_client->perf_mode = false;
prtd->audio_client = q6asm_audio_client_alloc(
(app_cb)event_handler, prtd);
if (!prtd->audio_client) {
@@ -290,6 +289,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
kfree(prtd);
return -ENOMEM;
}
prtd->audio_client->perf_mode = false;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
ret = q6asm_open_write(prtd->audio_client, FORMAT_LINEAR_PCM);
if (ret < 0) {