sim/alsa: don't let siwtch out when open alsa mixer

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-12-19 20:09:06 +08:00 committed by Xiang Xiao
parent c74627cbec
commit f2de1ce930

View File

@ -772,12 +772,13 @@ out:
static int sim_mixer_open(struct sim_audio_s *priv) static int sim_mixer_open(struct sim_audio_s *priv)
{ {
snd_mixer_selem_id_t *sid = NULL; snd_mixer_selem_id_t *sid = NULL;
irqstate_t flags = up_irq_save();
int ret; int ret;
ret = snd_mixer_open(&priv->mixer, 0); ret = snd_mixer_open(&priv->mixer, 0);
if (ret < 0) if (ret < 0)
{ {
return ret; goto fail;
} }
ret = snd_mixer_attach(priv->mixer, "default"); ret = snd_mixer_attach(priv->mixer, "default");
@ -841,9 +842,11 @@ static int sim_mixer_open(struct sim_audio_s *priv)
} }
} }
up_irq_restore(flags);
return 0; return 0;
fail: fail:
snd_mixer_close(priv->mixer); snd_mixer_close(priv->mixer);
up_irq_restore(flags);
priv->mixer = NULL; priv->mixer = NULL;
return 0; return 0;
} }