[PATCH] kfree cleanup: fs

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>
This commit is contained in:
Jesper Juhl 2005-11-07 01:01:34 -08:00 committed by Linus Torvalds
parent 6044ec8882
commit f99d49adf5
39 changed files with 137 additions and 245 deletions

View File

@ -269,7 +269,6 @@ static void v9fs_sock_close(struct v9fs_transport *trans)
dprintk(DEBUG_TRANS, "socket closed\n"); dprintk(DEBUG_TRANS, "socket closed\n");
} }
if (ts)
kfree(ts); kfree(ts);
trans->priv = NULL; trans->priv = NULL;

View File

@ -35,7 +35,6 @@ affs_put_super(struct super_block *sb)
mark_buffer_dirty(sbi->s_root_bh); mark_buffer_dirty(sbi->s_root_bh);
} }
if (sbi->s_prefix)
kfree(sbi->s_prefix); kfree(sbi->s_prefix);
affs_free_bitmap(sb); affs_free_bitmap(sb);
affs_brelse(sbi->s_root_bh); affs_brelse(sbi->s_root_bh);
@ -198,10 +197,9 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
*mount_opts |= SF_MUFS; *mount_opts |= SF_MUFS;
break; break;
case Opt_prefix: case Opt_prefix:
if (*prefix) { /* Free any previous prefix */ /* Free any previous prefix */
kfree(*prefix); kfree(*prefix);
*prefix = NULL; *prefix = NULL;
}
*prefix = match_strdup(&args[0]); *prefix = match_strdup(&args[0]);
if (!*prefix) if (!*prefix)
return 0; return 0;
@ -462,10 +460,8 @@ got_root:
out_error: out_error:
if (root_inode) if (root_inode)
iput(root_inode); iput(root_inode);
if (sbi->s_bitmap)
kfree(sbi->s_bitmap); kfree(sbi->s_bitmap);
affs_brelse(root_bh); affs_brelse(root_bh);
if (sbi->s_prefix)
kfree(sbi->s_prefix); kfree(sbi->s_prefix);
kfree(sbi); kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;

View File

@ -265,7 +265,6 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
set_page_private(page, 0); set_page_private(page, 0);
ClearPagePrivate(page); ClearPagePrivate(page);
if (pageio)
kfree(pageio); kfree(pageio);
} }

View File

@ -150,11 +150,9 @@ int autofs_wait(struct autofs_sb_info *sbi, struct qstr *name)
if ( sbi->catatonic ) { if ( sbi->catatonic ) {
/* We might have slept, so check again for catatonic mode */ /* We might have slept, so check again for catatonic mode */
wq->status = -ENOENT; wq->status = -ENOENT;
if ( wq->name ) {
kfree(wq->name); kfree(wq->name);
wq->name = NULL; wq->name = NULL;
} }
}
if ( wq->name ) { if ( wq->name ) {
/* Block all but "shutdown" signals while waiting */ /* Block all but "shutdown" signals while waiting */

View File

@ -22,10 +22,8 @@
static void ino_lnkfree(struct autofs_info *ino) static void ino_lnkfree(struct autofs_info *ino)
{ {
if (ino->u.symlink) {
kfree(ino->u.symlink); kfree(ino->u.symlink);
ino->u.symlink = NULL; ino->u.symlink = NULL;
}
} }
struct autofs_info *autofs4_init_ino(struct autofs_info *ino, struct autofs_info *autofs4_init_ino(struct autofs_info *ino,

View File

@ -243,11 +243,9 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
if ( sbi->catatonic ) { if ( sbi->catatonic ) {
/* We might have slept, so check again for catatonic mode */ /* We might have slept, so check again for catatonic mode */
wq->status = -ENOENT; wq->status = -ENOENT;
if ( wq->name ) {
kfree(wq->name); kfree(wq->name);
wq->name = NULL; wq->name = NULL;
} }
}
if ( wq->name ) { if ( wq->name ) {
/* Block all but "shutdown" signals while waiting */ /* Block all but "shutdown" signals while waiting */

View File

@ -725,20 +725,16 @@ parse_options(char *options, befs_mount_options * opts)
static void static void
befs_put_super(struct super_block *sb) befs_put_super(struct super_block *sb)
{ {
if (BEFS_SB(sb)->mount_opts.iocharset) {
kfree(BEFS_SB(sb)->mount_opts.iocharset); kfree(BEFS_SB(sb)->mount_opts.iocharset);
BEFS_SB(sb)->mount_opts.iocharset = NULL; BEFS_SB(sb)->mount_opts.iocharset = NULL;
}
if (BEFS_SB(sb)->nls) { if (BEFS_SB(sb)->nls) {
unload_nls(BEFS_SB(sb)->nls); unload_nls(BEFS_SB(sb)->nls);
BEFS_SB(sb)->nls = NULL; BEFS_SB(sb)->nls = NULL;
} }
if (sb->s_fs_info) {
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
}
return; return;
} }

View File

@ -1006,7 +1006,6 @@ out_free_dentry:
if (interpreter) if (interpreter)
fput(interpreter); fput(interpreter);
out_free_interp: out_free_interp:
if (elf_interpreter)
kfree(elf_interpreter); kfree(elf_interpreter);
out_free_file: out_free_file:
sys_close(elf_exec_fileno); sys_close(elf_exec_fileno);

View File

@ -411,15 +411,10 @@ error:
allow_write_access(interpreter); allow_write_access(interpreter);
fput(interpreter); fput(interpreter);
} }
if (interpreter_name)
kfree(interpreter_name); kfree(interpreter_name);
if (exec_params.phdrs)
kfree(exec_params.phdrs); kfree(exec_params.phdrs);
if (exec_params.loadmap)
kfree(exec_params.loadmap); kfree(exec_params.loadmap);
if (interp_params.phdrs)
kfree(interp_params.phdrs); kfree(interp_params.phdrs);
if (interp_params.loadmap)
kfree(interp_params.loadmap); kfree(interp_params.loadmap);
return retval; return retval;

View File

@ -553,7 +553,6 @@ decode_negTokenInit(unsigned char *security_blob, int length,
*(oid + 3))); *(oid + 3)));
rc = compare_oid(oid, oidlen, NTLMSSP_OID, rc = compare_oid(oid, oidlen, NTLMSSP_OID,
NTLMSSP_OID_LEN); NTLMSSP_OID_LEN);
if(oid)
kfree(oid); kfree(oid);
if (rc) if (rc)
use_ntlmssp = TRUE; use_ntlmssp = TRUE;

View File

@ -1265,7 +1265,6 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
the helper that resolves tcp names, mount to it, try to the helper that resolves tcp names, mount to it, try to
tcon to it unmount it if fail */ tcon to it unmount it if fail */
if(referrals)
kfree(referrals); kfree(referrals);
return rc; return rc;
@ -1535,9 +1534,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
memset(&volume_info,0,sizeof(struct smb_vol)); memset(&volume_info,0,sizeof(struct smb_vol));
if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
@ -1551,9 +1548,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifserror("No username specified "); cifserror("No username specified ");
/* In userspace mount helper we can get user name from alternate /* In userspace mount helper we can get user name from alternate
locations such as env variables and files on disk */ locations such as env variables and files on disk */
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
@ -1573,9 +1568,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if(rc <= 0) { if(rc <= 0) {
/* we failed translating address */ /* we failed translating address */
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
@ -1587,18 +1580,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
} else if (volume_info.UNCip){ } else if (volume_info.UNCip){
/* BB using ip addr as server name connect to the DFS root below */ /* BB using ip addr as server name connect to the DFS root below */
cERROR(1,("Connecting to DFS root not implemented yet")); cERROR(1,("Connecting to DFS root not implemented yet"));
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
} else /* which servers DFS root would we conect to */ { } else /* which servers DFS root would we conect to */ {
cERROR(1, cERROR(1,
("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified "));
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
@ -1612,9 +1601,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifs_sb->local_nls = load_nls(volume_info.iocharset); cifs_sb->local_nls = load_nls(volume_info.iocharset);
if(cifs_sb->local_nls == NULL) { if(cifs_sb->local_nls == NULL) {
cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset)); cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset));
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -ELIBACC; return -ELIBACC;
@ -1630,9 +1617,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
&sin_server6.sin6_addr, &sin_server6.sin6_addr,
volume_info.username, &srvTcp); volume_info.username, &srvTcp);
else { else {
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return -EINVAL; return -EINVAL;
@ -1654,9 +1639,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
("Error connecting to IPv4 socket. Aborting operation")); ("Error connecting to IPv4 socket. Aborting operation"));
if(csocket != NULL) if(csocket != NULL)
sock_release(csocket); sock_release(csocket);
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -1666,9 +1649,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if (srvTcp == NULL) { if (srvTcp == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
sock_release(csocket); sock_release(csocket);
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -1692,9 +1673,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if(rc < 0) { if(rc < 0) {
rc = -ENOMEM; rc = -ENOMEM;
sock_release(csocket); sock_release(csocket);
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -1710,7 +1689,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if (existingCifsSes) { if (existingCifsSes) {
pSesInfo = existingCifsSes; pSesInfo = existingCifsSes;
cFYI(1, ("Existing smb sess found ")); 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 */ /* volume_info.UNC freed at end of function */
} else if (!rc) { } else if (!rc) {
@ -1741,7 +1719,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
if(!rc) if(!rc)
atomic_inc(&srvTcp->socketUseCount); atomic_inc(&srvTcp->socketUseCount);
} else } else
if(volume_info.password)
kfree(volume_info.password); kfree(volume_info.password);
} }
@ -1821,7 +1798,6 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
"", cifs_sb->local_nls, "", cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
FreeXid(xid); FreeXid(xid);
return -ENODEV; return -ENODEV;
@ -1925,7 +1901,6 @@ 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 (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 the password ptr is put in the new session structure (in which case the
password will be freed at unmount time) */ password will be freed at unmount time) */
if(volume_info.UNC)
kfree(volume_info.UNC); kfree(volume_info.UNC);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -3283,7 +3258,6 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
if ((bcc_ptr + (2 * length)) - if ((bcc_ptr + (2 * length)) -
pByteArea(smb_buffer_response) <= pByteArea(smb_buffer_response) <=
BCC(smb_buffer_response)) { BCC(smb_buffer_response)) {
if(tcon->nativeFileSystem)
kfree(tcon->nativeFileSystem); kfree(tcon->nativeFileSystem);
tcon->nativeFileSystem = tcon->nativeFileSystem =
kzalloc(length + 2, GFP_KERNEL); kzalloc(length + 2, GFP_KERNEL);
@ -3301,7 +3275,6 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
if ((bcc_ptr + length) - if ((bcc_ptr + length) -
pByteArea(smb_buffer_response) <= pByteArea(smb_buffer_response) <=
BCC(smb_buffer_response)) { BCC(smb_buffer_response)) {
if(tcon->nativeFileSystem)
kfree(tcon->nativeFileSystem); kfree(tcon->nativeFileSystem);
tcon->nativeFileSystem = tcon->nativeFileSystem =
kzalloc(length + 1, GFP_KERNEL); kzalloc(length + 1, GFP_KERNEL);

View File

@ -84,9 +84,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
cifsInode->time = 0; /* will force revalidate to go get info when needed */ cifsInode->time = 0; /* will force revalidate to go get info when needed */
cifs_hl_exit: cifs_hl_exit:
if (fromName)
kfree(fromName); kfree(fromName);
if (toName)
kfree(toName); kfree(toName);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -206,7 +204,6 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
} }
} }
if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
@ -253,7 +250,6 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
len = buflen; len = buflen;
tmpbuffer = kmalloc(len,GFP_KERNEL); tmpbuffer = kmalloc(len,GFP_KERNEL);
if(tmpbuffer == NULL) { if(tmpbuffer == NULL) {
if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
return -ENOMEM; return -ENOMEM;
@ -303,7 +299,6 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
strncpy(tmpbuffer, referrals, len-1); strncpy(tmpbuffer, referrals, len-1);
} }
} }
if(referrals)
kfree(referrals); kfree(referrals);
kfree(tmp_path); kfree(tmp_path);
} }
@ -323,12 +318,8 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
rc)); rc));
} }
if (tmpbuffer) {
kfree(tmpbuffer); kfree(tmpbuffer);
}
if (full_path) {
kfree(full_path); kfree(full_path);
}
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }

View File

@ -98,13 +98,9 @@ sesInfoFree(struct cifsSesInfo *buf_to_free)
atomic_dec(&sesInfoAllocCount); atomic_dec(&sesInfoAllocCount);
list_del(&buf_to_free->cifsSessionList); list_del(&buf_to_free->cifsSessionList);
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
if (buf_to_free->serverOS)
kfree(buf_to_free->serverOS); kfree(buf_to_free->serverOS);
if (buf_to_free->serverDomain)
kfree(buf_to_free->serverDomain); kfree(buf_to_free->serverDomain);
if (buf_to_free->serverNOS)
kfree(buf_to_free->serverNOS); kfree(buf_to_free->serverNOS);
if (buf_to_free->password)
kfree(buf_to_free->password); kfree(buf_to_free->password);
kfree(buf_to_free); kfree(buf_to_free);
} }
@ -144,7 +140,6 @@ tconInfoFree(struct cifsTconInfo *buf_to_free)
atomic_dec(&tconInfoAllocCount); atomic_dec(&tconInfoAllocCount);
list_del(&buf_to_free->cifsConnectionList); list_del(&buf_to_free->cifsConnectionList);
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
if (buf_to_free->nativeFileSystem)
kfree(buf_to_free->nativeFileSystem); kfree(buf_to_free->nativeFileSystem);
kfree(buf_to_free); kfree(buf_to_free);
} }

View File

@ -87,7 +87,6 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
} }
remove_ea_exit: remove_ea_exit:
if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
#endif #endif
@ -132,7 +131,6 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
returns as xattrs */ returns as xattrs */
if(value_size > MAX_EA_VALUE_SIZE) { if(value_size > MAX_EA_VALUE_SIZE) {
cFYI(1,("size of EA value too large")); cFYI(1,("size of EA value too large"));
if(full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
return -EOPNOTSUPP; return -EOPNOTSUPP;
@ -195,7 +193,6 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
} }
set_ea_exit: set_ea_exit:
if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
#endif #endif
@ -298,7 +295,6 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
get_ea_exit: get_ea_exit:
if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
#endif #endif
@ -345,7 +341,6 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (full_path)
kfree(full_path); kfree(full_path);
FreeXid(xid); FreeXid(xid);
#endif #endif

View File

@ -2235,7 +2235,8 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
if (err) if (err)
err = -EFAULT; err = -EFAULT;
out: if (karg) kfree(karg); out:
kfree(karg);
return err; return err;
} }

View File

@ -2738,10 +2738,8 @@ static int devfsd_close(struct inode *inode, struct file *file)
entry = fs_info->devfsd_first_event; entry = fs_info->devfsd_first_event;
fs_info->devfsd_first_event = NULL; fs_info->devfsd_first_event = NULL;
fs_info->devfsd_last_event = NULL; fs_info->devfsd_last_event = NULL;
if (fs_info->devfsd_info) {
kfree(fs_info->devfsd_info); kfree(fs_info->devfsd_info);
fs_info->devfsd_info = NULL; fs_info->devfsd_info = NULL;
}
spin_unlock(&fs_info->devfsd_buffer_lock); spin_unlock(&fs_info->devfsd_buffer_lock);
fs_info->devfsd_pgrp = 0; fs_info->devfsd_pgrp = 0;
fs_info->devfsd_task = NULL; fs_info->devfsd_task = NULL;

View File

@ -194,7 +194,6 @@ ext2_get_acl(struct inode *inode, int type)
acl = NULL; acl = NULL;
else else
acl = ERR_PTR(retval); acl = ERR_PTR(retval);
if (value)
kfree(value); kfree(value);
if (!IS_ERR(acl)) { if (!IS_ERR(acl)) {
@ -262,7 +261,6 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
error = ext2_xattr_set(inode, name_index, "", value, size, 0); error = ext2_xattr_set(inode, name_index, "", value, size, 0);
if (value)
kfree(value); kfree(value);
if (!error) { if (!error) {
switch(type) { switch(type) {

View File

@ -294,7 +294,6 @@ static void hostfs_delete_inode(struct inode *inode)
static void hostfs_destroy_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 /*XXX: This should not happen, probably. The check is here for

View File

@ -244,12 +244,12 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
go_up: go_up:
if (namelen >= 256) { if (namelen >= 256) {
hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen); hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen);
if (nd) kfree(nd); kfree(nd);
kfree(nname); kfree(nname);
return 1; return 1;
} }
if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) { if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) {
if (nd) kfree(nd); kfree(nd);
kfree(nname); kfree(nname);
return 1; 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_sb(i->i_sb)->sb_chk)
if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) { if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) {
hpfs_brelse4(&qbh); hpfs_brelse4(&qbh);
if (nd) kfree(nd); kfree(nd);
kfree(nname); kfree(nname);
return 1; 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); for_all_poss(i, hpfs_pos_subst, 5, t + 1);
hpfs_mark_4buffers_dirty(&qbh); hpfs_mark_4buffers_dirty(&qbh);
hpfs_brelse4(&qbh); hpfs_brelse4(&qbh);
if (nd) kfree(nd); kfree(nd);
kfree(nname); kfree(nname);
return 0; return 0;
} }

View 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 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("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n");
} else printk("\n"); } else printk("\n");
if (buf) kfree(buf); kfree(buf);
hpfs_sb(s)->sb_was_error = 1; 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) static void hpfs_put_super(struct super_block *s)
{ {
struct hpfs_sb_info *sbi = hpfs_sb(s); struct hpfs_sb_info *sbi = hpfs_sb(s);
if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); kfree(sbi->sb_cp_table);
if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir); kfree(sbi->sb_bmp_dir);
unmark_dirty(s); unmark_dirty(s);
s->s_fs_info = NULL; s->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
@ -654,8 +654,8 @@ bail3: brelse(bh1);
bail2: brelse(bh0); bail2: brelse(bh0);
bail1: bail1:
bail0: bail0:
if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir); kfree(sbi->sb_bmp_dir);
if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); kfree(sbi->sb_cp_table);
s->s_fs_info = NULL; s->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
return -EINVAL; return -EINVAL;

View File

@ -855,7 +855,6 @@ root_found:
if (opt.check == 'r') table++; if (opt.check == 'r') table++;
s->s_root->d_op = &isofs_dentry_ops[table]; s->s_root->d_op = &isofs_dentry_ops[table];
if (opt.iocharset)
kfree(opt.iocharset); kfree(opt.iocharset);
return 0; return 0;
@ -895,7 +894,6 @@ out_unknown_format:
out_freebh: out_freebh:
brelse(bh); brelse(bh);
out_freesbi: out_freesbi:
if (opt.iocharset)
kfree(opt.iocharset); kfree(opt.iocharset);
kfree(sbi); kfree(sbi);
s->s_fs_info = NULL; s->s_fs_info = NULL;
@ -1164,7 +1162,6 @@ out_nomem:
out_noread: out_noread:
printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block); printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block);
if (tmpde)
kfree(tmpde); kfree(tmpde);
return -EIO; return -EIO;
@ -1334,7 +1331,6 @@ static void isofs_read_inode(struct inode *inode)
init_special_inode(inode, inode->i_mode, inode->i_rdev); init_special_inode(inode, inode->i_mode, inode->i_rdev);
out: out:
if (tmpde)
kfree(tmpde); kfree(tmpde);
if (bh) if (bh)
brelse(bh); brelse(bh);

View File

@ -261,10 +261,8 @@ void journal_commit_transaction(journal_t *journal)
struct buffer_head *bh = jh2bh(jh); struct buffer_head *bh = jh2bh(jh);
jbd_lock_bh_state(bh); jbd_lock_bh_state(bh);
if (jh->b_committed_data) {
kfree(jh->b_committed_data); kfree(jh->b_committed_data);
jh->b_committed_data = NULL; jh->b_committed_data = NULL;
}
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
} }
journal_refile_buffer(journal, jh); journal_refile_buffer(journal, jh);

View File

@ -227,7 +227,6 @@ repeat_locked:
spin_unlock(&transaction->t_handle_lock); spin_unlock(&transaction->t_handle_lock);
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
out: out:
if (new_transaction)
kfree(new_transaction); kfree(new_transaction);
return ret; return ret;
} }
@ -725,7 +724,6 @@ done:
journal_cancel_revoke(handle, jh); journal_cancel_revoke(handle, jh);
out: out:
if (frozen_buffer)
kfree(frozen_buffer); kfree(frozen_buffer);
JBUFFER_TRACE(jh, "exit"); JBUFFER_TRACE(jh, "exit");
@ -905,7 +903,6 @@ repeat:
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
out: out:
journal_put_journal_head(jh); journal_put_journal_head(jh);
if (committed_data)
kfree(committed_data); kfree(committed_data);
return err; return err;
} }

View File

@ -462,7 +462,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result)
} }
/* Free read buffer */ /* Free read buffer */
kfree (read_buf); kfree(read_buf);
/* Return result */ /* Return result */
D3(printk("checksum result: 0x%08x\n", sum)); D3(printk("checksum result: 0x%08x\n", sum));
@ -1011,12 +1011,12 @@ jffs_scan_flash(struct jffs_control *c)
offset , fmc->sector_size); offset , fmc->sector_size);
flash_safe_release(fmc->mtd); flash_safe_release(fmc->mtd);
kfree (read_buf); kfree(read_buf);
return -1; /* bad, bad, bad! */ return -1; /* bad, bad, bad! */
} }
flash_safe_release(fmc->mtd); flash_safe_release(fmc->mtd);
kfree (read_buf); kfree(read_buf);
return -EAGAIN; /* erased offending sector. Try mount one more time please. */ 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) {
if (!(node = jffs_alloc_node())) { if (!(node = jffs_alloc_node())) {
/* Free read buffer */ /* Free read buffer */
kfree (read_buf); kfree(read_buf);
/* Release the flash device */ /* Release the flash device */
flash_safe_release(fmc->mtd); flash_safe_release(fmc->mtd);
@ -1269,7 +1269,7 @@ jffs_scan_flash(struct jffs_control *c)
DJM(no_jffs_node--); DJM(no_jffs_node--);
/* Free read buffer */ /* Free read buffer */
kfree (read_buf); kfree(read_buf);
/* Release the flash device */ /* Release the flash device */
flash_safe_release(fmc->mtd); flash_safe_release(fmc->mtd);
@ -1296,7 +1296,7 @@ jffs_scan_flash(struct jffs_control *c)
flash_safe_release(fmc->flash_part); flash_safe_release(fmc->flash_part);
/* Free read buffer */ /* Free read buffer */
kfree (read_buf); kfree(read_buf);
return -ENOMEM; return -ENOMEM;
} }
@ -1324,7 +1324,7 @@ jffs_scan_flash(struct jffs_control *c)
jffs_build_end(fmc); jffs_build_end(fmc);
/* Free read buffer */ /* Free read buffer */
kfree (read_buf); kfree(read_buf);
if(!num_free_space){ if(!num_free_space){
printk(KERN_WARNING "jffs_scan_flash(): Did not find even a single " 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", printk("jffs_find_child(): Didn't find the file \"%s\".\n",
(copy ? copy : "")); (copy ? copy : ""));
if (copy) {
kfree(copy); kfree(copy);
}
}); });
return f; return f;

View File

@ -490,7 +490,7 @@ int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
up(&f->sem); up(&f->sem);
jffs2_do_clear_inode(c, f); jffs2_do_clear_inode(c, f);
} }
kfree (f); kfree(f);
return ret; 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 */ /* For symlink inodes we us f->dents to store the target path name */
if (S_ISLNK(OFNI_EDONI_2SFFJ(f)->i_mode)) { if (S_ISLNK(OFNI_EDONI_2SFFJ(f)->i_mode)) {
if (f->dents) {
kfree(f->dents); kfree(f->dents);
f->dents = NULL; f->dents = NULL;
}
} else { } else {
fds = f->dents; fds = f->dents;

View File

@ -327,7 +327,6 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
c->wbuf_ofs = ofs + towrite; c->wbuf_ofs = ofs + towrite;
memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len); memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len);
/* Don't muck about with c->wbuf_inodes. False positives are harmless. */ /* Don't muck about with c->wbuf_inodes. False positives are harmless. */
if (buf)
kfree(buf); kfree(buf);
} else { } else {
/* OK, now we're left with the dregs in whichever buffer we're using */ /* OK, now we're left with the dregs in whichever buffer we're using */

View File

@ -112,7 +112,6 @@ static struct nlm_lockowner *nlm_find_lockowner(struct nlm_host *host, fl_owner_
} }
} }
spin_unlock(&host->h_lock); spin_unlock(&host->h_lock);
if (new != NULL)
kfree(new); kfree(new);
return res; return res;
} }

View File

@ -301,7 +301,6 @@ fail:
if (cache) { if (cache) {
while (--m >= 0) while (--m >= 0)
kfree(cache->c_indexes_hash[m]); kfree(cache->c_indexes_hash[m]);
if (cache->c_block_hash)
kfree(cache->c_block_hash); kfree(cache->c_block_hash);
kfree(cache); kfree(cache);
} }

View File

@ -149,7 +149,6 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
} }
} }
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
if (delegation != NULL)
kfree(delegation); kfree(delegation);
return status; return status;
} }

View File

@ -1688,7 +1688,6 @@ static void nfs_kill_super(struct super_block *s)
rpciod_down(); /* release rpciod */ rpciod_down(); /* release rpciod */
if (server->hostname != NULL)
kfree(server->hostname); kfree(server->hostname);
kfree(server); kfree(server);
} }
@ -1908,7 +1907,6 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
if (copy_from_user(dst, src->data, maxlen)) { if (copy_from_user(dst, src->data, maxlen)) {
if (p != NULL)
kfree(p); kfree(p);
return ERR_PTR(-EFAULT); return ERR_PTR(-EFAULT);
} }
@ -2000,9 +1998,7 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
out_err: out_err:
s = (struct super_block *)p; s = (struct super_block *)p;
out_free: out_free:
if (server->mnt_path)
kfree(server->mnt_path); kfree(server->mnt_path);
if (server->hostname)
kfree(server->hostname); kfree(server->hostname);
kfree(server); kfree(server);
return s; return s;
@ -2023,7 +2019,6 @@ static void nfs4_kill_super(struct super_block *sb)
destroy_nfsv4_state(server); destroy_nfsv4_state(server);
if (server->hostname != NULL)
kfree(server->hostname); kfree(server->hostname);
kfree(server); kfree(server);
} }

View File

@ -69,10 +69,8 @@ init_nfsv4_state(struct nfs_server *server)
void void
destroy_nfsv4_state(struct nfs_server *server) destroy_nfsv4_state(struct nfs_server *server)
{ {
if (server->mnt_path) {
kfree(server->mnt_path); kfree(server->mnt_path);
server->mnt_path = NULL; server->mnt_path = NULL;
}
if (server->nfs4_state) { if (server->nfs4_state) {
nfs4_put_client(server->nfs4_state); nfs4_put_client(server->nfs4_state);
server->nfs4_state = NULL; server->nfs4_state = NULL;
@ -311,7 +309,6 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
new = NULL; new = NULL;
} }
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
if (new)
kfree(new); kfree(new);
if (sp != NULL) if (sp != NULL)
return sp; return sp;

View File

@ -52,7 +52,6 @@ nfs_put_unlinkdata(struct nfs_unlinkdata *data)
{ {
if (--data->count == 0) { if (--data->count == 0) {
nfs_detach_unlinkdata(data); nfs_detach_unlinkdata(data);
if (data->name.name != NULL)
kfree(data->name.name); kfree(data->name.name);
kfree(data); kfree(data);
} }

View File

@ -190,7 +190,6 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
out: out:
if (dom) if (dom)
auth_domain_put(dom); auth_domain_put(dom);
if (buf)
kfree(buf); kfree(buf);
return err; return err;
} }
@ -428,7 +427,6 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
path_release(&nd); path_release(&nd);
if (dom) if (dom)
auth_domain_put(dom); auth_domain_put(dom);
if (buf)
kfree(buf); kfree(buf);
return err; return err;
} }

View File

@ -151,7 +151,6 @@ static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
if (nbytes <= sizeof(argp->tmp)) if (nbytes <= sizeof(argp->tmp))
p = argp->tmp; p = argp->tmp;
else { else {
if (argp->tmpp)
kfree(argp->tmpp); kfree(argp->tmpp);
p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL); p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL);
if (!p) if (!p)
@ -2476,10 +2475,8 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args)
kfree(args->ops); kfree(args->ops);
args->ops = args->iops; args->ops = args->iops;
} }
if (args->tmpp) {
kfree(args->tmpp); kfree(args->tmpp);
args->tmpp = NULL; args->tmpp = NULL;
}
while (args->to_free) { while (args->to_free) {
struct tmpbuf *tb = args->to_free; struct tmpbuf *tb = args->to_free;
args->to_free = tb->next; args->to_free = tb->next;

View File

@ -93,7 +93,6 @@ nfsd_cache_shutdown(void)
cache_disabled = 1; cache_disabled = 1;
if (hash_list)
kfree (hash_list); kfree (hash_list);
hash_list = NULL; hash_list = NULL;
} }

View File

@ -1088,7 +1088,6 @@ static void __exit exit_openprom_fs(void)
unregister_filesystem(&openprom_fs_type); unregister_filesystem(&openprom_fs_type);
free_pages ((unsigned long)nodes, alloced); free_pages ((unsigned long)nodes, alloced);
for (i = 0; i < aliases_nodes; i++) for (i = 0; i < aliases_nodes; i++)
if (alias_names [i])
kfree (alias_names [i]); kfree (alias_names [i]);
nodes = NULL; nodes = NULL;
} }

View File

@ -39,7 +39,6 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
{\ {\
if (UDF_SB(X))\ if (UDF_SB(X))\
{\ {\
if (UDF_SB_PARTMAPS(X))\
kfree(UDF_SB_PARTMAPS(X));\ kfree(UDF_SB_PARTMAPS(X));\
UDF_SB_PARTMAPS(X) = NULL;\ UDF_SB_PARTMAPS(X) = NULL;\
}\ }\

View File

@ -472,13 +472,14 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
return 1; return 1;
failed: failed:
if (base) kfree (base); kfree (base);
if (sbi->s_ucg) { if (sbi->s_ucg) {
for (i = 0; i < uspi->s_ncg; i++) 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); kfree (sbi->s_ucg);
for (i = 0; i < UFS_MAX_GROUP_LOADED; i++) 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")) UFSD(("EXIT (FAILED)\n"))
return 0; return 0;
@ -981,9 +982,10 @@ magic_found:
dalloc_failed: dalloc_failed:
iput(inode); iput(inode);
failed: failed:
if (ubh) ubh_brelse_uspi (uspi); if (ubh)
if (uspi) kfree (uspi); ubh_brelse_uspi (uspi);
if (sbi) kfree(sbi); kfree (uspi);
kfree(sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
UFSD(("EXIT (FAILED)\n")) UFSD(("EXIT (FAILED)\n"))
return -EINVAL; return -EINVAL;

View File

@ -74,7 +74,6 @@ setxattr(struct dentry *d, char __user *name, void __user *value,
} }
out: out:
up(&d->d_inode->i_sem); up(&d->d_inode->i_sem);
if (kvalue)
kfree(kvalue); kfree(kvalue);
return error; return error;
} }
@ -173,7 +172,6 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size)
error = -E2BIG; error = -E2BIG;
} }
out: out:
if (kvalue)
kfree(kvalue); kfree(kvalue);
return error; return error;
} }
@ -259,7 +257,6 @@ listxattr(struct dentry *d, char __user *list, size_t size)
error = -E2BIG; error = -E2BIG;
} }
out: out:
if (klist)
kfree(klist); kfree(klist);
return error; return error;
} }