Commit f692fce0 authored by Cliff Cai's avatar Cliff Cai Committed by Mark Brown

ASoC: SSM2602: assign last substream to the master when shutting down

Fixes crash when shutting down.
Signed-off-by: default avatarCliff Cai <cliff.cai@analog.com>
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent cf485da1
...@@ -336,11 +336,13 @@ static int ssm2602_startup(struct snd_pcm_substream *substream, ...@@ -336,11 +336,13 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
master_runtime->sample_bits, master_runtime->sample_bits,
master_runtime->rate); master_runtime->rate);
if (master_runtime->rate != 0)
snd_pcm_hw_constraint_minmax(substream->runtime, snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_RATE, SNDRV_PCM_HW_PARAM_RATE,
master_runtime->rate, master_runtime->rate,
master_runtime->rate); master_runtime->rate);
if (master_runtime->sample_bits != 0)
snd_pcm_hw_constraint_minmax(substream->runtime, snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
master_runtime->sample_bits, master_runtime->sample_bits,
...@@ -372,6 +374,11 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream, ...@@ -372,6 +374,11 @@ static void ssm2602_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_device *socdev = rtd->socdev; struct snd_soc_device *socdev = rtd->socdev;
struct snd_soc_codec *codec = socdev->card->codec; struct snd_soc_codec *codec = socdev->card->codec;
struct ssm2602_priv *ssm2602 = codec->private_data; struct ssm2602_priv *ssm2602 = codec->private_data;
if (ssm2602->master_substream == substream)
ssm2602->master_substream = ssm2602->slave_substream;
ssm2602->slave_substream = NULL;
/* deactivate */ /* deactivate */
if (!codec->active) if (!codec->active)
ssm2602_write(codec, SSM2602_ACTIVE, 0); ssm2602_write(codec, SSM2602_ACTIVE, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment