From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Sun, 28 Dec 2014 13:36:28 +0100

The p9_client_clunk() function was called in four cases by the
v9fs_vfs_mknod_dotl() function during error handling even if the passed
variable "fid" contained a null pointer. The v9fs_put_acl() function could
also be unnecessarily called with null pointers.

* This implementation detail could be improved by the introduction of
  two jump labels.

* Let us delete also two unnecessary variable assignments there.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 fs/9p/vfs_inode_dotl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 3b38dda..ff3c26a 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -832,8 +832,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry 
*dentry, umode_t omode,
        if (IS_ERR(dfid)) {
                err = PTR_ERR(dfid);
                p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
-               dfid = NULL;
-               goto error;
+               goto exit;
        }
 
        gid = v9fs_get_fsgid_for_create(dir);
@@ -843,13 +842,13 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry 
*dentry, umode_t omode,
        if (err) {
                p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
                         err);
-               goto error;
+               goto exit;
        }
        name = (char *) dentry->d_name.name;
 
        err = p9_client_mknod_dotl(dfid, name, mode, rdev, gid, &qid);
        if (err < 0)
-               goto error;
+               goto put_acl;
 
        v9fs_invalidate_inode_attr(dir);
        fid = p9_client_walk(dfid, 1, &name, 1);
@@ -857,8 +856,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry 
*dentry, umode_t omode,
                err = PTR_ERR(fid);
                p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
                         err);
-               fid = NULL;
-               goto error;
+               goto put_acl;
        }
 
        /* instantiate inode and assign the unopened fid to the dentry */
@@ -890,7 +888,9 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry 
*dentry, umode_t omode,
        }
 error:
        p9_client_clunk(fid);
+put_acl:
        v9fs_put_acl(dacl, pacl);
+exit:
        return err;
 }
 
-- 
2.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to