aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2010-10-08 04:48:50 -0400
committerJaroslav Kysela <perex@perex.cz>2010-10-11 05:14:23 -0400
commit838c364ff05c143fd1810e8ad1469935d6c23a7a (patch)
tree0466bb384561d11916dfda126a518e7ae8ec9ca5 /sound/core
parentb1c73fc8e697eb73e23603e465e9af2711ed4183 (diff)
ALSA: OSS mixer emulation - fix locking
Fix mutex release and cleanup some locking code. Cc: <stable@kernel.org> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/oss/mixer_oss.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index f50ebf20df96..8442a088677d 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -618,8 +618,10 @@ static void snd_mixer_oss_put_volume1_vol(struct snd_mixer_oss_file *fmixer,
618 if (numid == ID_UNKNOWN) 618 if (numid == ID_UNKNOWN)
619 return; 619 return;
620 down_read(&card->controls_rwsem); 620 down_read(&card->controls_rwsem);
621 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) 621 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) {
622 up_read(&card->controls_rwsem);
622 return; 623 return;
624 }
623 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); 625 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
624 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 626 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
625 if (uinfo == NULL || uctl == NULL) 627 if (uinfo == NULL || uctl == NULL)
@@ -658,7 +660,7 @@ static void snd_mixer_oss_put_volume1_sw(struct snd_mixer_oss_file *fmixer,
658 return; 660 return;
659 down_read(&card->controls_rwsem); 661 down_read(&card->controls_rwsem);
660 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) { 662 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) {
661 up_read(&fmixer->card->controls_rwsem); 663 up_read(&card->controls_rwsem);
662 return; 664 return;
663 } 665 }
664 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); 666 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
@@ -797,7 +799,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
797 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 799 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
798 if (uinfo == NULL || uctl == NULL) { 800 if (uinfo == NULL || uctl == NULL) {
799 err = -ENOMEM; 801 err = -ENOMEM;
800 goto __unlock; 802 goto __free_only;
801 } 803 }
802 down_read(&card->controls_rwsem); 804 down_read(&card->controls_rwsem);
803 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); 805 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
@@ -826,6 +828,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
826 err = 0; 828 err = 0;
827 __unlock: 829 __unlock:
828 up_read(&card->controls_rwsem); 830 up_read(&card->controls_rwsem);
831 __free_only:
829 kfree(uctl); 832 kfree(uctl);
830 kfree(uinfo); 833 kfree(uinfo);
831 return err; 834 return err;
@@ -847,7 +850,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
847 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 850 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
848 if (uinfo == NULL || uctl == NULL) { 851 if (uinfo == NULL || uctl == NULL) {
849 err = -ENOMEM; 852 err = -ENOMEM;
850 goto __unlock; 853 goto __free_only;
851 } 854 }
852 down_read(&card->controls_rwsem); 855 down_read(&card->controls_rwsem);
853 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); 856 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
@@ -880,6 +883,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned
880 err = 0; 883 err = 0;
881 __unlock: 884 __unlock:
882 up_read(&card->controls_rwsem); 885 up_read(&card->controls_rwsem);
886 __free_only:
883 kfree(uctl); 887 kfree(uctl);
884 kfree(uinfo); 888 kfree(uinfo);
885 return err; 889 return err;