diff options
| author | Qiao Zhou <zhouqiao@marvell.com> | 2014-09-10 05:54:07 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2014-09-10 06:40:21 -0400 |
| commit | 8f70e515a8bb6a1908b40b786cb43f6491e8da04 (patch) | |
| tree | fd3a599d5323061479b01137035c588d562ac421 | |
| parent | 7d1311b93e58ed55f3a31cc8f94c4b8fe988a2b9 (diff) | |
ASoC: soc-pcm: fix dpcm_path_get error handling
dpcm_path_get may return -ENOMEM when allocating memory for list
fails. We should not keep processing path or start up dpcm dai in
this case.
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/soc-compress.c | 6 | ||||
| -rw-r--r-- | sound/soc/soc-pcm.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 27c06acce205..3092b58fede6 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
| @@ -101,7 +101,11 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) | |||
| 101 | 101 | ||
| 102 | fe->dpcm[stream].runtime = fe_substream->runtime; | 102 | fe->dpcm[stream].runtime = fe_substream->runtime; |
| 103 | 103 | ||
| 104 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 104 | ret = dpcm_path_get(fe, stream, &list); |
| 105 | if (ret < 0) { | ||
| 106 | mutex_unlock(&fe->card->mutex); | ||
| 107 | goto fe_err; | ||
| 108 | } else if (ret == 0) { | ||
| 105 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 109 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
| 106 | fe->dai_link->name, stream ? "capture" : "playback"); | 110 | fe->dai_link->name, stream ? "capture" : "playback"); |
| 107 | } | 111 | } |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 731fdb5b5f9b..642c86240752 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
| @@ -2352,7 +2352,11 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) | |||
| 2352 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 2352 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
| 2353 | fe->dpcm[stream].runtime = fe_substream->runtime; | 2353 | fe->dpcm[stream].runtime = fe_substream->runtime; |
| 2354 | 2354 | ||
| 2355 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 2355 | ret = dpcm_path_get(fe, stream, &list); |
| 2356 | if (ret < 0) { | ||
| 2357 | mutex_unlock(&fe->card->mutex); | ||
| 2358 | return ret; | ||
| 2359 | } else if (ret == 0) { | ||
| 2356 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 2360 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
| 2357 | fe->dai_link->name, stream ? "capture" : "playback"); | 2361 | fe->dai_link->name, stream ? "capture" : "playback"); |
| 2358 | } | 2362 | } |
