aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2005-09-06 18:17:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:33 -0400
commit39ed3fdeec1290dd246dcf1da6b278566987a084 (patch)
tree46b4f08e2c61eca5871c4805ec4448f1408f2e69 /kernel/futex.c
parent580b2e3c0183818adf6151e60270405b02ea8504 (diff)
[PATCH] futex: remove duplicate code
This patch cleans up the error path of futex_fd() by removing duplicate code. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 07ba87de9658..ca05fe6a70b2 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -786,23 +786,17 @@ static int futex_fd(unsigned long uaddr, int signal)
786 filp->f_mapping = filp->f_dentry->d_inode->i_mapping; 786 filp->f_mapping = filp->f_dentry->d_inode->i_mapping;
787 787
788 if (signal) { 788 if (signal) {
789 int err;
790 err = f_setown(filp, current->pid, 1); 789 err = f_setown(filp, current->pid, 1);
791 if (err < 0) { 790 if (err < 0) {
792 put_unused_fd(ret); 791 goto error;
793 put_filp(filp);
794 ret = err;
795 goto out;
796 } 792 }
797 filp->f_owner.signum = signal; 793 filp->f_owner.signum = signal;
798 } 794 }
799 795
800 q = kmalloc(sizeof(*q), GFP_KERNEL); 796 q = kmalloc(sizeof(*q), GFP_KERNEL);
801 if (!q) { 797 if (!q) {
802 put_unused_fd(ret); 798 err = -ENOMEM;
803 put_filp(filp); 799 goto error;
804 ret = -ENOMEM;
805 goto out;
806 } 800 }
807 801
808 down_read(&current->mm->mmap_sem); 802 down_read(&current->mm->mmap_sem);
@@ -810,10 +804,8 @@ static int futex_fd(unsigned long uaddr, int signal)
810 804
811 if (unlikely(err != 0)) { 805 if (unlikely(err != 0)) {
812 up_read(&current->mm->mmap_sem); 806 up_read(&current->mm->mmap_sem);
813 put_unused_fd(ret);
814 put_filp(filp);
815 kfree(q); 807 kfree(q);
816 return err; 808 goto error;
817 } 809 }
818 810
819 /* 811 /*
@@ -829,6 +821,11 @@ static int futex_fd(unsigned long uaddr, int signal)
829 fd_install(ret, filp); 821 fd_install(ret, filp);
830out: 822out:
831 return ret; 823 return ret;
824error:
825 put_unused_fd(ret);
826 put_filp(filp);
827 ret = err;
828 goto out;
832} 829}
833 830
834long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout, 831long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout,