From f7d34dfb86026d81b2303ae6c63fece2db21cfd0 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 17 Aug 2009 12:27:22 +0200 Subject: [PATCH] --- yaml --- r: 157751 b: refs/heads/master c: f217ac59b6dd73105abc13da3fe656391fa6d135 h: refs/heads/master i: 157749: b8b24a19db28b7c51ebbcb6d2f2d23b5c2627230 157747: 8826e69d9de1b317b7410e77a4f7cfa90e66cc12 157743: 0160d7a5bdb1e0bf1c2c84d534d23c2cde9027d3 v: v3 --- [refs] | 2 +- trunk/sound/core/control.c | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 471724cd2bf5..6196102f40cf 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 317b80817fcaeac7ae7e062fcccef0d2aba38a78 +refs/heads/master: f217ac59b6dd73105abc13da3fe656391fa6d135 diff --git a/trunk/sound/core/control.c b/trunk/sound/core/control.c index 9d91f77bc880..bc64b723415b 100644 --- a/trunk/sound/core/control.c +++ b/trunk/sound/core/control.c @@ -414,7 +414,7 @@ int snd_ctl_remove_id(struct snd_card *card, struct snd_ctl_elem_id *id) EXPORT_SYMBOL(snd_ctl_remove_id); /** - * snd_ctl_remove_unlocked_id - remove the unlocked control of the given id and release it + * snd_ctl_remove_user_ctl - remove and release the unlocked user control * @file: active control handle * @id: the control id to remove * @@ -423,8 +423,8 @@ EXPORT_SYMBOL(snd_ctl_remove_id); * * Returns 0 if successful, or a negative error code on failure. */ -static int snd_ctl_remove_unlocked_id(struct snd_ctl_file * file, - struct snd_ctl_elem_id *id) +static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file, + struct snd_ctl_elem_id *id) { struct snd_card *card = file->card; struct snd_kcontrol *kctl; @@ -442,6 +442,9 @@ static int snd_ctl_remove_unlocked_id(struct snd_ctl_file * file, goto error; } ret = snd_ctl_remove(card, kctl); + if (ret < 0) + goto error; + card->user_ctl_count--; error: up_write(&card->controls_rwsem); return ret; @@ -1053,18 +1056,10 @@ static int snd_ctl_elem_remove(struct snd_ctl_file *file, struct snd_ctl_elem_id __user *_id) { struct snd_ctl_elem_id id; - int err; if (copy_from_user(&id, _id, sizeof(id))) return -EFAULT; - err = snd_ctl_remove_unlocked_id(file, &id); - if (! err) { - struct snd_card *card = file->card; - down_write(&card->controls_rwsem); - card->user_ctl_count--; - up_write(&card->controls_rwsem); - } - return err; + return snd_ctl_remove_user_ctl(file, &id); } static int snd_ctl_subscribe_events(struct snd_ctl_file *file, int __user *ptr)