]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/cifs/link.c
[CIFS] Cleanup sparse warnings for unicode little endian casts
[linux-2.6-omap-h63xx.git] / fs / cifs / link.c
index b8ec6646456a743bbf9d56f2d88df0eea6de4e45..0f99aae33162fbd68f5e08a32713db3055a418cf 100644 (file)
@@ -49,8 +49,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
    BB note DFS case in future though (when we may have to check) */
 
        down(&inode->i_sb->s_vfs_rename_sem);
-       fromName = build_path_from_dentry(old_file, cifs_sb_target);
-       toName = build_path_from_dentry(direntry, cifs_sb_target);
+       fromName = build_path_from_dentry(old_file);
+       toName = build_path_from_dentry(direntry);
        up(&inode->i_sb->s_vfs_rename_sem);
        if((fromName == NULL) || (toName == NULL)) {
                rc = -ENOMEM;
@@ -84,10 +84,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
        cifsInode->time = 0;    /* will force revalidate to go get info when needed */
 
 cifs_hl_exit:
-       if (fromName)
-               kfree(fromName);
-       if (toName)
-               kfree(toName);
+       kfree(fromName);
+       kfree(toName);
        FreeXid(xid);
        return rc;
 }
@@ -105,17 +103,16 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
 
        xid = GetXid();
 
-       cifs_sb = CIFS_SB(inode->i_sb);
-       pTcon = cifs_sb->tcon;
-
        down(&direntry->d_sb->s_vfs_rename_sem);
-       full_path = build_path_from_dentry(direntry, cifs_sb);
+       full_path = build_path_from_dentry(direntry);
        up(&direntry->d_sb->s_vfs_rename_sem);
 
        if (!full_path)
                goto out_no_free;
 
        cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode));
+       cifs_sb = CIFS_SB(inode->i_sb);
+       pTcon = cifs_sb->tcon;
        target_path = kmalloc(PATH_MAX, GFP_KERNEL);
        if (!target_path) {
                target_path = ERR_PTR(-ENOMEM);
@@ -168,7 +165,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
        pTcon = cifs_sb->tcon;
 
        down(&inode->i_sb->s_vfs_rename_sem);
-       full_path = build_path_from_dentry(direntry, cifs_sb);
+       full_path = build_path_from_dentry(direntry);
        up(&inode->i_sb->s_vfs_rename_sem);
 
        if(full_path == NULL) {
@@ -207,8 +204,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
                }
        }
 
-       if (full_path)
-               kfree(full_path);
+       kfree(full_path);
        FreeXid(xid);
        return rc;
 }
@@ -237,7 +233,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
 /* BB would it be safe against deadlock to grab this sem 
       even though rename itself grabs the sem and calls lookup? */
 /*       down(&inode->i_sb->s_vfs_rename_sem);*/
-       full_path = build_path_from_dentry(direntry, cifs_sb);
+       full_path = build_path_from_dentry(direntry);
 /*       up(&inode->i_sb->s_vfs_rename_sem);*/
 
        if(full_path == NULL) {
@@ -254,8 +250,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
                len = buflen;
        tmpbuffer = kmalloc(len,GFP_KERNEL);   
        if(tmpbuffer == NULL) {
-               if (full_path)
-                       kfree(full_path);
+               kfree(full_path);
                FreeXid(xid);
                return -ENOMEM;
        }
@@ -304,8 +299,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
                                                        strncpy(tmpbuffer, referrals, len-1);                            
                                                }
                                        }
-                                       if(referrals)
-                                               kfree(referrals);
+                                       kfree(referrals);
                                        kfree(tmp_path);
 }
                                /* BB add code like else decode referrals then memcpy to
@@ -324,12 +318,8 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
                      rc));
        }
 
-       if (tmpbuffer) {
-               kfree(tmpbuffer);
-       }
-       if (full_path) {
-               kfree(full_path);
-       }
+       kfree(tmpbuffer);
+       kfree(full_path);
        FreeXid(xid);
        return rc;
 }