Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e32b8ee27b486f682a6d13533cfe6549c8abcdef
Commit:     e32b8ee27b486f682a6d13533cfe6549c8abcdef
Parent:     d2ab0b0c4c2570921a9ec1eff1e3a5143e05b231
Author:     J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Thu Mar 1 14:34:35 2007 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:09:27 2007 -0400

    locks: clean up lease_alloc()
    
    Return the newly allocated structure as the return value instead of
    using a struct ** parameter.
    
    Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
---
 fs/locks.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 3c23fd2..838ca54 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -458,22 +458,20 @@ static int lease_init(struct file *filp, int type, struct 
file_lock *fl)
 }
 
 /* Allocate a file_lock initialised to this type of lease */
-static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
+static struct file_lock *lease_alloc(struct file *filp, int type)
 {
        struct file_lock *fl = locks_alloc_lock();
        int error = -ENOMEM;
 
        if (fl == NULL)
-               goto out;
+               return ERR_PTR(error);
 
        error = lease_init(filp, type, fl);
        if (error) {
                locks_free_lock(fl);
-               fl = NULL;
+               return ERR_PTR(error);
        }
-out:
-       *flp = fl;
-       return error;
+       return fl;
 }
 
 /* Check if two locks overlap each other.
@@ -1179,12 +1177,10 @@ int __break_lease(struct inode *inode, unsigned int 
mode)
        int error = 0, future;
        struct file_lock *new_fl, *flock;
        struct file_lock *fl;
-       int alloc_err;
        unsigned long break_time;
        int i_have_this_lease = 0;
 
-       alloc_err = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK,
-                       &new_fl);
+       new_fl = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK);
 
        lock_kernel();
 
@@ -1212,8 +1208,9 @@ int __break_lease(struct inode *inode, unsigned int mode)
                goto out;
        }
 
-       if (alloc_err && !i_have_this_lease && ((mode & O_NONBLOCK) == 0)) {
-               error = alloc_err;
+       if (IS_ERR(new_fl) && !i_have_this_lease
+                       && ((mode & O_NONBLOCK) == 0)) {
+               error = PTR_ERR(new_fl);
                goto out;
        }
 
@@ -1260,7 +1257,7 @@ restart:
 
 out:
        unlock_kernel();
-       if (!alloc_err)
+       if (!IS_ERR(new_fl))
                locks_free_lock(new_fl);
        return error;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to