提交 317b8081 编写于 作者: C Clemens Ladisch 提交者: Takashi Iwai

sound: snd_ctl_remove_unlocked_id: simplify error paths

Use a common exit path to release the mutex and to return a possible
error.
Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 2a031aed
...@@ -433,15 +433,16 @@ static int snd_ctl_remove_unlocked_id(struct snd_ctl_file * file, ...@@ -433,15 +433,16 @@ static int snd_ctl_remove_unlocked_id(struct snd_ctl_file * file,
down_write(&card->controls_rwsem); down_write(&card->controls_rwsem);
kctl = snd_ctl_find_id(card, id); kctl = snd_ctl_find_id(card, id);
if (kctl == NULL) { if (kctl == NULL) {
up_write(&card->controls_rwsem); ret = -ENOENT;
return -ENOENT; goto error;
} }
for (idx = 0; idx < kctl->count; idx++) for (idx = 0; idx < kctl->count; idx++)
if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) { if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
up_write(&card->controls_rwsem); ret = -EBUSY;
return -EBUSY; goto error;
} }
ret = snd_ctl_remove(card, kctl); ret = snd_ctl_remove(card, kctl);
error:
up_write(&card->controls_rwsem); up_write(&card->controls_rwsem);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册