Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 317b8081 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai
Browse files

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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2a031aed
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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;
}