* [PATCH] futex: remove duplicate code
@ 2005-08-23 15:07 Pekka Enberg
0 siblings, 0 replies; only message in thread
From: Pekka Enberg @ 2005-08-23 15:07 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, jamie, mingo, rusty
Hi!
This patch cleans up the error path of futex_fd() by removing duplicate
code.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
futex.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
Index: 2.6-mm/kernel/futex.c
===================================================================
--- 2.6-mm.orig/kernel/futex.c
+++ 2.6-mm/kernel/futex.c
@@ -673,23 +673,17 @@ static int futex_fd(unsigned long uaddr,
filp->f_mapping = filp->f_dentry->d_inode->i_mapping;
if (signal) {
- int err;
err = f_setown(filp, current->pid, 1);
if (err < 0) {
- put_unused_fd(ret);
- put_filp(filp);
- ret = err;
- goto out;
+ goto error;
}
filp->f_owner.signum = signal;
}
q = kmalloc(sizeof(*q), GFP_KERNEL);
if (!q) {
- put_unused_fd(ret);
- put_filp(filp);
- ret = -ENOMEM;
- goto out;
+ err = -ENOMEM;
+ goto error;
}
down_read(¤t->mm->mmap_sem);
@@ -697,10 +691,8 @@ static int futex_fd(unsigned long uaddr,
if (unlikely(err != 0)) {
up_read(¤t->mm->mmap_sem);
- put_unused_fd(ret);
- put_filp(filp);
kfree(q);
- return err;
+ goto error;
}
/*
@@ -716,6 +708,11 @@ static int futex_fd(unsigned long uaddr,
fd_install(ret, filp);
out:
return ret;
+error:
+ put_unused_fd(ret);
+ put_filp(filp);
+ ret = err;
+ goto out;
}
long do_futex(unsigned long uaddr, int op, int val, unsigned long timeout,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-08-23 15:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-23 15:07 [PATCH] futex: remove duplicate code Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).