mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
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: Clemens Ladisch <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
This commit is contained in:
parent
2a031aedf7
commit
317b80817f
1 changed files with 5 additions and 4 deletions
|
|
@ -433,15 +433,16 @@ static int snd_ctl_remove_unlocked_id(struct snd_ctl_file * file,
|
|||
down_write(&card->controls_rwsem);
|
||||
kctl = snd_ctl_find_id(card, id);
|
||||
if (kctl == NULL) {
|
||||
up_write(&card->controls_rwsem);
|
||||
return -ENOENT;
|
||||
ret = -ENOENT;
|
||||
goto error;
|
||||
}
|
||||
for (idx = 0; idx < kctl->count; idx++)
|
||||
if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
|
||||
up_write(&card->controls_rwsem);
|
||||
return -EBUSY;
|
||||
ret = -EBUSY;
|
||||
goto error;
|
||||
}
|
||||
ret = snd_ctl_remove(card, kctl);
|
||||
error:
|
||||
up_write(&card->controls_rwsem);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue