diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-08-17 12:26:34 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-08-17 12:48:06 +0200 |
commit | 317b80817fcaeac7ae7e062fcccef0d2aba38a78 (patch) | |
tree | 37edf39c0171d13be1facc3b14916909ccc43a99 /sound/core/control.c | |
parent | 2a031aedf7f574a01eb725507cb303d4d7b8b23a (diff) | |
download | op-kernel-dev-317b80817fcaeac7ae7e062fcccef0d2aba38a78.zip op-kernel-dev-317b80817fcaeac7ae7e062fcccef0d2aba38a78.tar.gz |
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 <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index 66d6aaf..9d91f77 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -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; } |