]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] kfree cleanup: fs
authorJesper Juhl <jesper.juhl@gmail.com>
Mon, 7 Nov 2005 09:01:34 +0000 (01:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:54:06 +0000 (07:54 -0800)
This is the fs/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in fs/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
39 files changed:
fs/9p/trans_sock.c
fs/affs/super.c
fs/afs/file.c
fs/autofs/waitq.c
fs/autofs4/inode.c
fs/autofs4/waitq.c
fs/befs/linuxvfs.c
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/cifs/asn1.c
fs/cifs/connect.c
fs/cifs/link.c
fs/cifs/misc.c
fs/cifs/xattr.c
fs/compat_ioctl.c
fs/devfs/base.c
fs/ext2/acl.c
fs/hostfs/hostfs_kern.c
fs/hpfs/dnode.c
fs/hpfs/super.c
fs/isofs/inode.c
fs/jbd/commit.c
fs/jbd/transaction.c
fs/jffs/intrep.c
fs/jffs2/readinode.c
fs/jffs2/wbuf.c
fs/lockd/clntproc.c
fs/mbcache.c
fs/nfs/delegation.c
fs/nfs/inode.c
fs/nfs/nfs4state.c
fs/nfs/unlink.c
fs/nfsd/export.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfscache.c
fs/openpromfs/inode.c
fs/udf/udf_sb.h
fs/ufs/super.c
fs/xattr.c

index 01e26f0013aced186efe40992d34996999ded2da..a93c2bf94c331a7b20326caa5a36c217fab3f023 100644 (file)
@@ -269,8 +269,7 @@ static void v9fs_sock_close(struct v9fs_transport *trans)
                dprintk(DEBUG_TRANS, "socket closed\n");
        }
 
-       if (ts)
-               kfree(ts);
+       kfree(ts);
 
        trans->priv = NULL;
 }
index 9c3080716c924526a481c313e9176e093669068d..aaec015a16e4f48d5ee3c124006ac47f91e4ec33 100644 (file)
@@ -35,8 +35,7 @@ affs_put_super(struct super_block *sb)
                mark_buffer_dirty(sbi->s_root_bh);
        }
 
-       if (sbi->s_prefix)
-               kfree(sbi->s_prefix);
+       kfree(sbi->s_prefix);
        affs_free_bitmap(sb);
        affs_brelse(sbi->s_root_bh);
        kfree(sbi);
@@ -198,10 +197,9 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
                        *mount_opts |= SF_MUFS;
                        break;
                case Opt_prefix:
-                       if (*prefix) {          /* Free any previous prefix */
-                               kfree(*prefix);
-                               *prefix = NULL;
-                       }
+                       /* Free any previous prefix */
+                       kfree(*prefix);
+                       *prefix = NULL;
                        *prefix = match_strdup(&args[0]);
                        if (!*prefix)
                                return 0;
@@ -462,11 +460,9 @@ got_root:
 out_error:
        if (root_inode)
                iput(root_inode);
-       if (sbi->s_bitmap)
-               kfree(sbi->s_bitmap);
+       kfree(sbi->s_bitmap);
        affs_brelse(root_bh);
-       if (sbi->s_prefix)
-               kfree(sbi->s_prefix);
+       kfree(sbi->s_prefix);
        kfree(sbi);
        sb->s_fs_info = NULL;
        return -EINVAL;
index f53971a543b23202a13c704be25a07ee8078ea67..150b192279228a3dfee74846a6f8f48d38e933fd 100644 (file)
@@ -265,8 +265,7 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
                set_page_private(page, 0);
                ClearPagePrivate(page);
 
-               if (pageio)
-                       kfree(pageio);
+               kfree(pageio);
        }
 
        _leave(" = 0");
index 1fcaa1568541c79060996da33a52cd6f6b58d189..633f628005b4a773b3e9326263b6892cdbce6b92 100644 (file)
@@ -150,10 +150,8 @@ int autofs_wait(struct autofs_sb_info *sbi, struct qstr *name)
        if ( sbi->catatonic ) {
                /* We might have slept, so check again for catatonic mode */
                wq->status = -ENOENT;
-               if ( wq->name ) {
-                       kfree(wq->name);
-                       wq->name = NULL;
-               }
+               kfree(wq->name);
+               wq->name = NULL;
        }
 
        if ( wq->name ) {
index 0a3c05d101679ea0dd24d2794a9a66f64ab5ba10..818b37be5153f3d7508ac00c215c2f523f01999f 100644 (file)
 
 static void ino_lnkfree(struct autofs_info *ino)
 {
-       if (ino->u.symlink) {
-               kfree(ino->u.symlink);
-               ino->u.symlink = NULL;
-       }
+       kfree(ino->u.symlink);
+       ino->u.symlink = NULL;
 }
 
 struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
index 3df86285a1c7e981e054d145fb134b89673336ab..394ff36ef8f19ec84a4f26a0c1a96e2badb7cb84 100644 (file)
@@ -243,10 +243,8 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
        if ( sbi->catatonic ) {
                /* We might have slept, so check again for catatonic mode */
                wq->status = -ENOENT;
-               if ( wq->name ) {
-                       kfree(wq->name);
-                       wq->name = NULL;
-               }
+               kfree(wq->name);
+               wq->name = NULL;
        }
 
        if ( wq->name ) {
index e8112ad5365dff2ebf5028f81566c2064bc45081..2d365cb8eec60948e631cf7b2d0ea33e45b94219 100644 (file)
@@ -725,20 +725,16 @@ parse_options(char *options, befs_mount_options * opts)
 static void
 befs_put_super(struct super_block *sb)
 {
-       if (BEFS_SB(sb)->mount_opts.iocharset) {
-               kfree(BEFS_SB(sb)->mount_opts.iocharset);
-               BEFS_SB(sb)->mount_opts.iocharset = NULL;
-       }
+       kfree(BEFS_SB(sb)->mount_opts.iocharset);
+       BEFS_SB(sb)->mount_opts.iocharset = NULL;
 
        if (BEFS_SB(sb)->nls) {
                unload_nls(BEFS_SB(sb)->nls);
                BEFS_SB(sb)->nls = NULL;
        }
 
-       if (sb->s_fs_info) {
-               kfree(sb->s_fs_info);
-               sb->s_fs_info = NULL;
-       }
+       kfree(sb->s_fs_info);
+       sb->s_fs_info = NULL;
        return;
 }
 
index 6fa6adc409726e8b79038bbdac31e510e248fed7..f36f2210204f524b2922fa69ea704295bfbe5a59 100644 (file)
@@ -1006,8 +1006,7 @@ out_free_dentry:
        if (interpreter)
                fput(interpreter);
 out_free_interp:
-       if (elf_interpreter)
-               kfree(elf_interpreter);
+       kfree(elf_interpreter);
 out_free_file:
        sys_close(elf_exec_fileno);
 out_free_fh:
index dda87c4c82a3c98c08109d577d98d24c70a2d5a9..e0344f69c79d971ce4fb95992ca4d3e13f32fbe5 100644 (file)
@@ -411,16 +411,11 @@ error:
                allow_write_access(interpreter);
                fput(interpreter);
        }
-       if (interpreter_name)
-               kfree(interpreter_name);
-       if (exec_params.phdrs)
-               kfree(exec_params.phdrs);
-       if (exec_params.loadmap)
-               kfree(exec_params.loadmap);
-       if (interp_params.phdrs)
-               kfree(interp_params.phdrs);
-       if (interp_params.loadmap)
-               kfree(interp_params.loadmap);
+       kfree(interpreter_name);
+       kfree(exec_params.phdrs);
+       kfree(exec_params.loadmap);
+       kfree(interp_params.phdrs);
+       kfree(interp_params.loadmap);
        return retval;
 
        /* unrecoverable error - kill the process */
index 98539e2afe81e92494ad27c4c49789126847df8e..086ae8f4a207a22f0d1bfe2863439ed20bd88f89 100644 (file)
@@ -553,8 +553,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
                                           *(oid + 3)));
                                        rc = compare_oid(oid, oidlen, NTLMSSP_OID,
                                                 NTLMSSP_OID_LEN);
-                                       if(oid)
-                                               kfree(oid);
+                                       kfree(oid);
                                        if (rc)
                                                use_ntlmssp = TRUE;
                                }
index d74367a08d513dd4cf6bb6a3aa090996972ea7f5..450ab75d654623d492c6969fc312bd041083fa2a 100644 (file)
@@ -1265,8 +1265,7 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
                the helper that resolves tcp names, mount to it, try to 
                tcon to it unmount it if fail */
 
-       if(referrals)
-               kfree(referrals);
+       kfree(referrals);
 
        return rc;
 }
@@ -1535,10 +1534,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
        
        memset(&volume_info,0,sizeof(struct smb_vol));
        if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
-               if(volume_info.UNC)
-                       kfree(volume_info.UNC);
-               if(volume_info.password)
-                       kfree(volume_info.password);
+               kfree(volume_info.UNC);
+               kfree(volume_info.password);
                FreeXid(xid);
                return -EINVAL;
        }
@@ -1551,10 +1548,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                cifserror("No username specified ");
         /* In userspace mount helper we can get user name from alternate
            locations such as env variables and files on disk */
-               if(volume_info.UNC)
-                       kfree(volume_info.UNC);
-               if(volume_info.password)
-                       kfree(volume_info.password);
+               kfree(volume_info.UNC);
+               kfree(volume_info.password);
                FreeXid(xid);
                return -EINVAL;
        }
@@ -1573,10 +1568,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
        
                if(rc <= 0) {
                        /* we failed translating address */
-                       if(volume_info.UNC)
-                               kfree(volume_info.UNC);
-                       if(volume_info.password)
-                               kfree(volume_info.password);
+                       kfree(volume_info.UNC);
+                       kfree(volume_info.password);
                        FreeXid(xid);
                        return -EINVAL;
                }
@@ -1587,19 +1580,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
        } else if (volume_info.UNCip){
                /* BB using ip addr as server name connect to the DFS root below */
                cERROR(1,("Connecting to DFS root not implemented yet"));
-               if(volume_info.UNC)
-                       kfree(volume_info.UNC);
-               if(volume_info.password)
-                       kfree(volume_info.password);
+               kfree(volume_info.UNC);
+               kfree(volume_info.password);
                FreeXid(xid);
                return -EINVAL;
        } else /* which servers DFS root would we conect to */ {
                cERROR(1,
                       ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified  "));
-               if(volume_info.UNC)
-                       kfree(volume_info.UNC);
-               if(volume_info.password)
-                       kfree(volume_info.password);
+               kfree(volume_info.UNC);
+               kfree(volume_info.password);
                FreeXid(xid);
                return -EINVAL;
        }
@@ -1612,10 +1601,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                cifs_sb->local_nls = load_nls(volume_info.iocharset);
                if(cifs_sb->local_nls == NULL) {
                        cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset));
-                       if(volume_info.UNC)
-                               kfree(volume_info.UNC);
-                       if(volume_info.password)
-                               kfree(volume_info.password);
+                       kfree(volume_info.UNC);
+                       kfree(volume_info.password);
                        FreeXid(xid);
                        return -ELIBACC;
                }
@@ -1630,10 +1617,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        &sin_server6.sin6_addr,
                        volume_info.username, &srvTcp);
        else {
-               if(volume_info.UNC)
-                       kfree(volume_info.UNC);
-               if(volume_info.password)
-                       kfree(volume_info.password);
+               kfree(volume_info.UNC);
+               kfree(volume_info.password);
                FreeXid(xid);
                return -EINVAL;
        }
@@ -1654,10 +1639,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                               ("Error connecting to IPv4 socket. Aborting operation"));
                        if(csocket != NULL)
                                sock_release(csocket);
-                       if(volume_info.UNC)
-                               kfree(volume_info.UNC);
-                       if(volume_info.password)
-                               kfree(volume_info.password);
+                       kfree(volume_info.UNC);
+                       kfree(volume_info.password);
                        FreeXid(xid);
                        return rc;
                }
@@ -1666,10 +1649,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                if (srvTcp == NULL) {
                        rc = -ENOMEM;
                        sock_release(csocket);
-                       if(volume_info.UNC)
-                               kfree(volume_info.UNC);
-                       if(volume_info.password)
-                               kfree(volume_info.password);
+                       kfree(volume_info.UNC);
+                       kfree(volume_info.password);
                        FreeXid(xid);
                        return rc;
                } else {
@@ -1692,10 +1673,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        if(rc < 0) {
                                rc = -ENOMEM;
                                sock_release(csocket);
-                               if(volume_info.UNC)
-                                       kfree(volume_info.UNC);
-                               if(volume_info.password)
-                                       kfree(volume_info.password);
+                               kfree(volume_info.UNC);
+                               kfree(volume_info.password);
                                FreeXid(xid);
                                return rc;
                        }
@@ -1710,8 +1689,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
        if (existingCifsSes) {
                pSesInfo = existingCifsSes;
                cFYI(1, ("Existing smb sess found "));
-               if(volume_info.password)
-                       kfree(volume_info.password);
+               kfree(volume_info.password);
                /* volume_info.UNC freed at end of function */
        } else if (!rc) {
                cFYI(1, ("Existing smb sess not found "));
@@ -1741,8 +1719,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                        if(!rc)
                                atomic_inc(&srvTcp->socketUseCount);
                } else
-                       if(volume_info.password)
-                               kfree(volume_info.password);
+                       kfree(volume_info.password);
        }
     
        /* search for existing tcon to this server share */
@@ -1821,8 +1798,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                                                        "", cifs_sb->local_nls,
                                                        cifs_sb->mnt_cifs_flags & 
                                                          CIFS_MOUNT_MAP_SPECIAL_CHR);
-                                       if(volume_info.UNC)
-                                               kfree(volume_info.UNC);
+                                       kfree(volume_info.UNC);
                                        FreeXid(xid);
                                        return -ENODEV;
                                } else {
@@ -1925,8 +1901,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
        (in which case it is not needed anymore) but when new sesion is created
        the password ptr is put in the new session structure (in which case the
        password will be freed at unmount time) */
-       if(volume_info.UNC)
-               kfree(volume_info.UNC);
+       kfree(volume_info.UNC);
        FreeXid(xid);
        return rc;
 }
@@ -3283,8 +3258,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
                        if ((bcc_ptr + (2 * length)) -
                             pByteArea(smb_buffer_response) <=
                            BCC(smb_buffer_response)) {
-                               if(tcon->nativeFileSystem)
-                                       kfree(tcon->nativeFileSystem);
+                               kfree(tcon->nativeFileSystem);
                                tcon->nativeFileSystem =
                                    kzalloc(length + 2, GFP_KERNEL);
                                cifs_strfromUCS_le(tcon->nativeFileSystem,
@@ -3301,8 +3275,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
                        if ((bcc_ptr + length) -
                            pByteArea(smb_buffer_response) <=
                            BCC(smb_buffer_response)) {
-                               if(tcon->nativeFileSystem)
-                                       kfree(tcon->nativeFileSystem);
+                               kfree(tcon->nativeFileSystem);
                                tcon->nativeFileSystem =
                                    kzalloc(length + 1, GFP_KERNEL);
                                strncpy(tcon->nativeFileSystem, bcc_ptr,
index b43e071fe1106446fc2e48fc05299a7b8fabce4a..0f99aae33162fbd68f5e08a32713db3055a418cf 100644 (file)
@@ -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;
 }
@@ -206,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;
 }
@@ -253,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;
        }
@@ -303,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
@@ -323,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;
 }
index eba1de917f2a87c2d9d5a173978c26f4e10e06b2..34a06692e4fa9461e624e8ace35de0536d4240d9 100644 (file)
@@ -98,14 +98,10 @@ sesInfoFree(struct cifsSesInfo *buf_to_free)
        atomic_dec(&sesInfoAllocCount);
        list_del(&buf_to_free->cifsSessionList);
        write_unlock(&GlobalSMBSeslock);
-       if (buf_to_free->serverOS)
-               kfree(buf_to_free->serverOS);
-       if (buf_to_free->serverDomain)
-               kfree(buf_to_free->serverDomain);
-       if (buf_to_free->serverNOS)
-               kfree(buf_to_free->serverNOS);
-       if (buf_to_free->password)
-               kfree(buf_to_free->password);
+       kfree(buf_to_free->serverOS);
+       kfree(buf_to_free->serverDomain);
+       kfree(buf_to_free->serverNOS);
+       kfree(buf_to_free->password);
        kfree(buf_to_free);
 }
 
@@ -144,8 +140,7 @@ tconInfoFree(struct cifsTconInfo *buf_to_free)
        atomic_dec(&tconInfoAllocCount);
        list_del(&buf_to_free->cifsConnectionList);
        write_unlock(&GlobalSMBSeslock);
-       if (buf_to_free->nativeFileSystem)
-               kfree(buf_to_free->nativeFileSystem);
+       kfree(buf_to_free->nativeFileSystem);
        kfree(buf_to_free);
 }
 
index c1e02eff1d25a222613f48b5312cb055776abc00..f375f87c7dbd3698a07290a9953e219cf49b0513 100644 (file)
@@ -87,8 +87,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
                        cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
        }
 remove_ea_exit:
-       if (full_path)
-               kfree(full_path);
+       kfree(full_path);
        FreeXid(xid);
 #endif
        return rc;
@@ -132,8 +131,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
                returns as xattrs */
        if(value_size > MAX_EA_VALUE_SIZE) {
                cFYI(1,("size of EA value too large"));
-               if(full_path)
-                       kfree(full_path);
+               kfree(full_path);
                FreeXid(xid);
                return -EOPNOTSUPP;
        }
@@ -195,8 +193,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
        }
 
 set_ea_exit:
-       if (full_path)
-               kfree(full_path);
+       kfree(full_path);
        FreeXid(xid);
 #endif
        return rc;
@@ -298,8 +295,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
                rc = -EOPNOTSUPP; 
 
 get_ea_exit:
-       if (full_path)
-               kfree(full_path);
+       kfree(full_path);
        FreeXid(xid);
 #endif
        return rc;
@@ -345,8 +341,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
                                cifs_sb->mnt_cifs_flags & 
                                        CIFS_MOUNT_MAP_SPECIAL_CHR);
 
-       if (full_path)
-               kfree(full_path);
+       kfree(full_path);
        FreeXid(xid);
 #endif
        return rc;
index 43dbcb0b21ebcc2ec51cfcc1052fc2879b73cbeb..4909754ea84a9873d931280c0af377d3d6abe15e 100644 (file)
@@ -2235,7 +2235,8 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
        if (err)
                err = -EFAULT;
 
-out:   if (karg) kfree(karg);
+out:
+       kfree(karg);
        return err;
 }
 
index 8b679b67e5e0f78e18dbd25015f7990cfa6f1f5a..1274422a5384d26e366a57c56152f8383da90677 100644 (file)
@@ -2738,10 +2738,8 @@ static int devfsd_close(struct inode *inode, struct file *file)
        entry = fs_info->devfsd_first_event;
        fs_info->devfsd_first_event = NULL;
        fs_info->devfsd_last_event = NULL;
-       if (fs_info->devfsd_info) {
-               kfree(fs_info->devfsd_info);
-               fs_info->devfsd_info = NULL;
-       }
+       kfree(fs_info->devfsd_info);
+       fs_info->devfsd_info = NULL;
        spin_unlock(&fs_info->devfsd_buffer_lock);
        fs_info->devfsd_pgrp = 0;
        fs_info->devfsd_task = NULL;
index 213148c36ebef341ae8c460af7cd2d9c095a5d3b..6af2f41302905a8e863912b8153e9d30a82911fd 100644 (file)
@@ -194,8 +194,7 @@ ext2_get_acl(struct inode *inode, int type)
                acl = NULL;
        else
                acl = ERR_PTR(retval);
-       if (value)
-               kfree(value);
+       kfree(value);
 
        if (!IS_ERR(acl)) {
                switch(type) {
@@ -262,8 +261,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 
        error = ext2_xattr_set(inode, name_index, "", value, size, 0);
 
-       if (value)
-               kfree(value);
+       kfree(value);
        if (!error) {
                switch(type) {
                        case ACL_TYPE_ACCESS:
index dd7113106269992822e97e4bbf07ad2bc5ab5eca..a33fb1d91373f873d559a26e1a8494e363ecc86c 100644 (file)
@@ -294,8 +294,7 @@ static void hostfs_delete_inode(struct inode *inode)
 
 static void hostfs_destroy_inode(struct inode *inode)
 {
-       if(HOSTFS_I(inode)->host_filename)
-               kfree(HOSTFS_I(inode)->host_filename);
+       kfree(HOSTFS_I(inode)->host_filename);
 
        /*XXX: This should not happen, probably. The check is here for
         * additional safety.*/
index 1d21307730a8362cd9e8a1f961bcf81e19c39dc2..229ff2fb1809f7b6276c66655b47679f013225c6 100644 (file)
@@ -244,12 +244,12 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
        go_up:
        if (namelen >= 256) {
                hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen);
-               if (nd) kfree(nd);
+               kfree(nd);
                kfree(nname);
                return 1;
        }
        if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) {
-               if (nd) kfree(nd);
+               kfree(nd);
                kfree(nname);
                return 1;
        }
@@ -257,7 +257,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
        if (hpfs_sb(i->i_sb)->sb_chk)
                if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) {
                        hpfs_brelse4(&qbh);
-                       if (nd) kfree(nd);
+                       kfree(nd);
                        kfree(nname);
                        return 1;
                }
@@ -270,7 +270,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
                for_all_poss(i, hpfs_pos_subst, 5, t + 1);
                hpfs_mark_4buffers_dirty(&qbh);
                hpfs_brelse4(&qbh);
-               if (nd) kfree(nd);
+               kfree(nd);
                kfree(nname);
                return 0;
        }
index 8eefa6366db748ae145dde7bfb8ca6b4325a81f4..63e88d7e2c3b56842fb38d12a9bebb2d6d837724 100644 (file)
@@ -75,7 +75,7 @@ void hpfs_error(struct super_block *s, char *m,...)
                } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n");
                else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n");
        } else printk("\n");
-       if (buf) kfree(buf);
+       kfree(buf);
        hpfs_sb(s)->sb_was_error = 1;
 }
 
@@ -102,8 +102,8 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
 static void hpfs_put_super(struct super_block *s)
 {
        struct hpfs_sb_info *sbi = hpfs_sb(s);
-       if (sbi->sb_cp_table) kfree(sbi->sb_cp_table);
-       if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir);
+       kfree(sbi->sb_cp_table);
+       kfree(sbi->sb_bmp_dir);
        unmark_dirty(s);
        s->s_fs_info = NULL;
        kfree(sbi);
@@ -654,8 +654,8 @@ bail3:      brelse(bh1);
 bail2: brelse(bh0);
 bail1:
 bail0:
-       if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir);
-       if (sbi->sb_cp_table) kfree(sbi->sb_cp_table);
+       kfree(sbi->sb_bmp_dir);
+       kfree(sbi->sb_cp_table);
        s->s_fs_info = NULL;
        kfree(sbi);
        return -EINVAL;
index 1652de1b6cb9e0a57bb9d33f6dff568b3f84196d..298f08be22d46ceb2e8a0d11121d9e3de7ecd594 100644 (file)
@@ -855,8 +855,7 @@ root_found:
        if (opt.check == 'r') table++;
        s->s_root->d_op = &isofs_dentry_ops[table];
 
-       if (opt.iocharset)
-               kfree(opt.iocharset);
+       kfree(opt.iocharset);
 
        return 0;
 
@@ -895,8 +894,7 @@ out_unknown_format:
 out_freebh:
        brelse(bh);
 out_freesbi:
-       if (opt.iocharset)
-               kfree(opt.iocharset);
+       kfree(opt.iocharset);
        kfree(sbi);
        s->s_fs_info = NULL;
        return -EINVAL;
@@ -1164,8 +1162,7 @@ out_nomem:
 
 out_noread:
        printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block);
-       if (tmpde)
-               kfree(tmpde);
+       kfree(tmpde);
        return -EIO;
 
 out_toomany:
@@ -1334,8 +1331,7 @@ static void isofs_read_inode(struct inode *inode)
                init_special_inode(inode, inode->i_mode, inode->i_rdev);
 
 out:
-       if (tmpde)
-               kfree(tmpde);
+       kfree(tmpde);
        if (bh)
                brelse(bh);
        return;
index 2a3e310f79efa7c3665dd037dd572ca35780677f..002ad2bbc76992b6acda52def147799886147693 100644 (file)
@@ -261,10 +261,8 @@ void journal_commit_transaction(journal_t *journal)
                        struct buffer_head *bh = jh2bh(jh);
 
                        jbd_lock_bh_state(bh);
-                       if (jh->b_committed_data) {
-                               kfree(jh->b_committed_data);
-                               jh->b_committed_data = NULL;
-                       }
+                       kfree(jh->b_committed_data);
+                       jh->b_committed_data = NULL;
                        jbd_unlock_bh_state(bh);
                }
                journal_refile_buffer(journal, jh);
index 13cb05bf60489e0005d635d66a63b47692ed72a6..429f4b263cf1198bf179af4377ff8b1c21af3d5e 100644 (file)
@@ -227,8 +227,7 @@ repeat_locked:
        spin_unlock(&transaction->t_handle_lock);
        spin_unlock(&journal->j_state_lock);
 out:
-       if (new_transaction)
-               kfree(new_transaction);
+       kfree(new_transaction);
        return ret;
 }
 
@@ -725,8 +724,7 @@ done:
        journal_cancel_revoke(handle, jh);
 
 out:
-       if (frozen_buffer)
-               kfree(frozen_buffer);
+       kfree(frozen_buffer);
 
        JBUFFER_TRACE(jh, "exit");
        return error;
@@ -905,8 +903,7 @@ repeat:
        jbd_unlock_bh_state(bh);
 out:
        journal_put_journal_head(jh);
-       if (committed_data)
-               kfree(committed_data);
+       kfree(committed_data);
        return err;
 }
 
index 27f199e94cfc8edd369775b4e962eee517dc3a14..b2e95421d932025407f758bb590d49b165a0a05a 100644 (file)
@@ -462,7 +462,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result)
        }
 
        /* Free read buffer */
-       kfree (read_buf);
+       kfree(read_buf);
 
        /* Return result */
        D3(printk("checksum result: 0x%08x\n", sum));
@@ -1011,12 +1011,12 @@ jffs_scan_flash(struct jffs_control *c)
                                                       offset , fmc->sector_size);
 
                                                flash_safe_release(fmc->mtd);
-                                               kfree (read_buf);
+                                               kfree(read_buf);
                                                return -1; /* bad, bad, bad! */
 
                                        }
                                        flash_safe_release(fmc->mtd);
-                                       kfree (read_buf);
+                                       kfree(read_buf);
 
                                        return -EAGAIN; /* erased offending sector. Try mount one more time please. */
                                }
@@ -1112,7 +1112,7 @@ jffs_scan_flash(struct jffs_control *c)
                if (!node) {
                        if (!(node = jffs_alloc_node())) {
                                /* Free read buffer */
-                               kfree (read_buf);
+                               kfree(read_buf);
 
                                /* Release the flash device */
                                flash_safe_release(fmc->mtd);
@@ -1269,7 +1269,7 @@ jffs_scan_flash(struct jffs_control *c)
                                DJM(no_jffs_node--);
 
                                /* Free read buffer */
-                               kfree (read_buf);
+                               kfree(read_buf);
 
                                /* Release the flash device */
                                flash_safe_release(fmc->mtd);
@@ -1296,7 +1296,7 @@ jffs_scan_flash(struct jffs_control *c)
                                        flash_safe_release(fmc->flash_part);
 
                                        /* Free read buffer */
-                                       kfree (read_buf);
+                                       kfree(read_buf);
 
                                        return -ENOMEM;
                                }
@@ -1324,7 +1324,7 @@ jffs_scan_flash(struct jffs_control *c)
        jffs_build_end(fmc);
 
        /* Free read buffer */
-       kfree (read_buf);
+       kfree(read_buf);
 
        if(!num_free_space){
                printk(KERN_WARNING "jffs_scan_flash(): Did not find even a single "
@@ -1747,9 +1747,7 @@ jffs_find_child(struct jffs_file *dir, const char *name, int len)
                }
                printk("jffs_find_child(): Didn't find the file \"%s\".\n",
                       (copy ? copy : ""));
-               if (copy) {
-                       kfree(copy);
-               }
+               kfree(copy);
        });
 
        return f;
index 5b2a83599d73c6649130c161293505384e60e114..1a96903e3ef3786362d459d2089d5ee01750e45c 100644 (file)
@@ -490,7 +490,7 @@ int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
                up(&f->sem);
                jffs2_do_clear_inode(c, f);
        }
-       kfree (f);
+       kfree(f);
        return ret;
 }
 
@@ -742,10 +742,8 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f)
 
        /* For symlink inodes we us f->dents to store the target path name */
        if (S_ISLNK(OFNI_EDONI_2SFFJ(f)->i_mode)) {
-               if (f->dents) {
-                       kfree(f->dents);
-                       f->dents = NULL;
-               }
+               kfree(f->dents);
+               f->dents = NULL;
        } else {
                fds = f->dents;
 
index 316133c626b7424fc68ccfce9043c5d92c6e359d..7bc7f2d571f68f9bca429d23a41e0754ad9274f9 100644 (file)
@@ -327,8 +327,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
                c->wbuf_ofs = ofs + towrite;
                memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len);
                /* Don't muck about with c->wbuf_inodes. False positives are harmless. */
-               if (buf)
-                       kfree(buf);
+               kfree(buf);
        } else {
                /* OK, now we're left with the dregs in whichever buffer we're using */
                if (buf) {
index 87332f30141b621b7478f3faacfac6e4c226d991..c5a33648e9fd5b6d88e50c42f9252d48f87cc57d 100644 (file)
@@ -112,8 +112,7 @@ static struct nlm_lockowner *nlm_find_lockowner(struct nlm_host *host, fl_owner_
                }
        }
        spin_unlock(&host->h_lock);
-       if (new != NULL)
-               kfree(new);
+       kfree(new);
        return res;
 }
 
index 298997f174755649a7b3ca5b72bb9e2613a53464..0f1e4530670f18567cc788b39af3ebbced8388ed 100644 (file)
@@ -301,8 +301,7 @@ fail:
        if (cache) {
                while (--m >= 0)
                        kfree(cache->c_indexes_hash[m]);
-               if (cache->c_block_hash)
-                       kfree(cache->c_block_hash);
+               kfree(cache->c_block_hash);
                kfree(cache);
        }
        return NULL;
index 3976c177a7d0ed25b87dbf6e26014f25027a3cb7..618a327027b3a1215e6d0cfd720d7d1813e18c88 100644 (file)
@@ -149,8 +149,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
                }
        }
        spin_unlock(&clp->cl_lock);
-       if (delegation != NULL)
-               kfree(delegation);
+       kfree(delegation);
        return status;
 }
 
index 24d2fbf549bda5ee2f468fd3278e1695958270ac..6391d89642144366591df7e7c0e6733b12916899 100644 (file)
@@ -1688,8 +1688,7 @@ static void nfs_kill_super(struct super_block *s)
 
        rpciod_down();          /* release rpciod */
 
-       if (server->hostname != NULL)
-               kfree(server->hostname);
+       kfree(server->hostname);
        kfree(server);
 }
 
@@ -1908,8 +1907,7 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen)
                        return ERR_PTR(-ENOMEM);
        }
        if (copy_from_user(dst, src->data, maxlen)) {
-               if (p != NULL)
-                       kfree(p);
+               kfree(p);
                return ERR_PTR(-EFAULT);
        }
        dst[maxlen] = '\0';
@@ -2000,10 +1998,8 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
 out_err:
        s = (struct super_block *)p;
 out_free:
-       if (server->mnt_path)
-               kfree(server->mnt_path);
-       if (server->hostname)
-               kfree(server->hostname);
+       kfree(server->mnt_path);
+       kfree(server->hostname);
        kfree(server);
        return s;
 }
@@ -2023,8 +2019,7 @@ static void nfs4_kill_super(struct super_block *sb)
 
        destroy_nfsv4_state(server);
 
-       if (server->hostname != NULL)
-               kfree(server->hostname);
+       kfree(server->hostname);
        kfree(server);
 }
 
index 52a26baa114c2110bd196b40ac5116a547570130..0675f3215e0a4fb7512f4950b007dfcb98420489 100644 (file)
@@ -69,10 +69,8 @@ init_nfsv4_state(struct nfs_server *server)
 void
 destroy_nfsv4_state(struct nfs_server *server)
 {
-       if (server->mnt_path) {
-               kfree(server->mnt_path);
-               server->mnt_path = NULL;
-       }
+       kfree(server->mnt_path);
+       server->mnt_path = NULL;
        if (server->nfs4_state) {
                nfs4_put_client(server->nfs4_state);
                server->nfs4_state = NULL;
@@ -311,8 +309,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
                new = NULL;
        }
        spin_unlock(&clp->cl_lock);
-       if (new)
-               kfree(new);
+       kfree(new);
        if (sp != NULL)
                return sp;
        put_rpccred(cred);
index f732541a33329fa2886ad2b56101704f62146cab..d639d172d568fac861124a4e43c8d8f946741438 100644 (file)
@@ -52,8 +52,7 @@ nfs_put_unlinkdata(struct nfs_unlinkdata *data)
 {
        if (--data->count == 0) {
                nfs_detach_unlinkdata(data);
-               if (data->name.name != NULL)
-                       kfree(data->name.name);
+               kfree(data->name.name);
                kfree(data);
        }
 }
index 057aff745506da64d5ca6b61d00f0eb41c597029..417ec02df44f33145504eabd72c940ea6efb3662 100644 (file)
@@ -190,8 +190,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
  out:
        if (dom)
                auth_domain_put(dom);
-       if (buf)
-               kfree(buf);
+       kfree(buf);
        return err;
 }
 
@@ -428,8 +427,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
                path_release(&nd);
        if (dom)
                auth_domain_put(dom);
-       if (buf)
-               kfree(buf);
+       kfree(buf);
        return err;
 }
 
index 4c4146350236be796c83072bd01e3913e344db71..dcd673186944a22f48317c3ecf52e889d1357b86 100644 (file)
@@ -151,8 +151,7 @@ static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
        if (nbytes <= sizeof(argp->tmp))
                p = argp->tmp;
        else {
-               if (argp->tmpp)
-                       kfree(argp->tmpp);
+               kfree(argp->tmpp);
                p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL);
                if (!p)
                        return NULL;
@@ -2476,10 +2475,8 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args)
                kfree(args->ops);
                args->ops = args->iops;
        }
-       if (args->tmpp) {
-               kfree(args->tmpp);
-               args->tmpp = NULL;
-       }
+       kfree(args->tmpp);
+       args->tmpp = NULL;
        while (args->to_free) {
                struct tmpbuf *tb = args->to_free;
                args->to_free = tb->next;
index 119e4d4495b8909f41555d6f40386d4663f4207a..d852ebb538e397b83e90aa504a105dcbc50ba98f 100644 (file)
@@ -93,8 +93,7 @@ nfsd_cache_shutdown(void)
 
        cache_disabled = 1;
 
-       if (hash_list)
-               kfree (hash_list);
+       kfree (hash_list);
        hash_list = NULL;
 }
 
index 1be11ce96b0f915f4ebc2ea2ba1deba8068eb4e5..aeb0106890e4f1db6dc903f3d5e94f3724278ab0 100644 (file)
@@ -1088,8 +1088,7 @@ static void __exit exit_openprom_fs(void)
        unregister_filesystem(&openprom_fs_type);
        free_pages ((unsigned long)nodes, alloced);
        for (i = 0; i < aliases_nodes; i++)
-               if (alias_names [i])
-                       kfree (alias_names [i]);
+               kfree (alias_names [i]);
        nodes = NULL;
 }
 
index 0e54922daa0917ef802a73edf998f467c7b09c9d..663669810be60afbae65f2a262a657f98bfa7f64 100644 (file)
@@ -39,8 +39,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
 {\
        if (UDF_SB(X))\
        {\
-               if (UDF_SB_PARTMAPS(X))\
-                       kfree(UDF_SB_PARTMAPS(X));\
+               kfree(UDF_SB_PARTMAPS(X));\
                UDF_SB_PARTMAPS(X) = NULL;\
        }\
 }
index f036d694ba5afe75263862b30870c4ff6794c590..54828ebcf1bacda4d1c94dc4461cd99d8264234d 100644 (file)
@@ -472,13 +472,14 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
        return 1;
 
 failed:
-       if (base) kfree (base);
+       kfree (base);
        if (sbi->s_ucg) {
                for (i = 0; i < uspi->s_ncg; i++)
-                       if (sbi->s_ucg[i]) brelse (sbi->s_ucg[i]);
+                       if (sbi->s_ucg[i])
+                               brelse (sbi->s_ucg[i]);
                kfree (sbi->s_ucg);
                for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
-                       if (sbi->s_ucpi[i]) kfree (sbi->s_ucpi[i]);
+                       kfree (sbi->s_ucpi[i]);
        }
        UFSD(("EXIT (FAILED)\n"))
        return 0;
@@ -981,9 +982,10 @@ magic_found:
 dalloc_failed:
        iput(inode);
 failed:
-       if (ubh) ubh_brelse_uspi (uspi);
-       if (uspi) kfree (uspi);
-       if (sbi) kfree(sbi);
+       if (ubh)
+               ubh_brelse_uspi (uspi);
+       kfree (uspi);
+       kfree(sbi);
        sb->s_fs_info = NULL;
        UFSD(("EXIT (FAILED)\n"))
        return -EINVAL;
index f6e00c0e114f6225d1f7af66517dd537aa0724bf..a9db225579983b4babe40ac4c47a9eef0a3250cb 100644 (file)
@@ -74,8 +74,7 @@ setxattr(struct dentry *d, char __user *name, void __user *value,
        }
 out:
        up(&d->d_inode->i_sem);
-       if (kvalue)
-               kfree(kvalue);
+       kfree(kvalue);
        return error;
 }
 
@@ -173,8 +172,7 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size)
                error = -E2BIG;
        }
 out:
-       if (kvalue)
-               kfree(kvalue);
+       kfree(kvalue);
        return error;
 }
 
@@ -259,8 +257,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
                error = -E2BIG;
        }
 out:
-       if (klist)
-               kfree(klist);
+       kfree(klist);
        return error;
 }