ALSA: emu10k1: Go back and simplify with snd_ctl_find_id()

Now that snd_ctl_find_id() takes the locking itself, we can get rid of
the messy locking in the caller side in snd_emu10k1_verify_controls().

Link: https://lore.kernel.org/r/20230718141304.1032-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2023-07-18 16:13:04 +02:00
parent 9c2cc5652e
commit 3315cf9583
1 changed files with 1 additions and 4 deletions

View File

@ -799,13 +799,10 @@ static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,
if (snd_emu10k1_look_for_ctl(emu, &gctl->id))
continue;
gctl_id = (struct snd_ctl_elem_id *)&gctl->id;
down_read(&emu->card->controls_rwsem);
if (snd_ctl_find_id_locked(emu->card, gctl_id)) {
up_read(&emu->card->controls_rwsem);
if (snd_ctl_find_id(emu->card, gctl_id)) {
err = -EEXIST;
goto __error;
}
up_read(&emu->card->controls_rwsem);
if (gctl_id->iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
gctl_id->iface != SNDRV_CTL_ELEM_IFACE_PCM) {
err = -EINVAL;