aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/control.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2009-08-17 06:26:34 -0400
committerTakashi Iwai <tiwai@suse.de>2009-08-17 06:48:06 -0400
commit317b80817fcaeac7ae7e062fcccef0d2aba38a78 (patch)
tree37edf39c0171d13be1facc3b14916909ccc43a99 /sound/core/control.c
parent2a031aedf7f574a01eb725507cb303d4d7b8b23a (diff)
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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index 66d6aaf9314..9d91f77bc88 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,
433 down_write(&card->controls_rwsem); 433 down_write(&card->controls_rwsem);
434 kctl = snd_ctl_find_id(card, id); 434 kctl = snd_ctl_find_id(card, id);
435 if (kctl == NULL) { 435 if (kctl == NULL) {
436 up_write(&card->controls_rwsem); 436 ret = -ENOENT;
437 return -ENOENT; 437 goto error;
438 } 438 }
439 for (idx = 0; idx < kctl->count; idx++) 439 for (idx = 0; idx < kctl->count; idx++)
440 if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) { 440 if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
441 up_write(&card->controls_rwsem); 441 ret = -EBUSY;
442 return -EBUSY; 442 goto error;
443 } 443 }
444 ret = snd_ctl_remove(card, kctl); 444 ret = snd_ctl_remove(card, kctl);
445error:
445 up_write(&card->controls_rwsem); 446 up_write(&card->controls_rwsem);
446 return ret; 447 return ret;
447} 448}