aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2005-11-07 04:01:34 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:54:06 -0500
commitf99d49adf527fa6f7a9c42257fa76bca6b8df1e3 (patch)
tree41dddbc336016f9dc9557cdb15300de5e599dac1 /fs
parent6044ec8882c726e325017bd948aa0cd94ad33abc (diff)
[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>
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/trans_sock.c3
-rw-r--r--fs/affs/super.c16
-rw-r--r--fs/afs/file.c3
-rw-r--r--fs/autofs/waitq.c6
-rw-r--r--fs/autofs4/inode.c6
-rw-r--r--fs/autofs4/waitq.c6
-rw-r--r--fs/befs/linuxvfs.c12
-rw-r--r--fs/binfmt_elf.c3
-rw-r--r--fs/binfmt_elf_fdpic.c15
-rw-r--r--fs/cifs/asn1.c3
-rw-r--r--fs/cifs/connect.c81
-rw-r--r--fs/cifs/link.c23
-rw-r--r--fs/cifs/misc.c15
-rw-r--r--fs/cifs/xattr.c15
-rw-r--r--fs/compat_ioctl.c3
-rw-r--r--fs/devfs/base.c6
-rw-r--r--fs/ext2/acl.c6
-rw-r--r--fs/hostfs/hostfs_kern.c3
-rw-r--r--fs/hpfs/dnode.c8
-rw-r--r--fs/hpfs/super.c10
-rw-r--r--fs/isofs/inode.c12
-rw-r--r--fs/jbd/commit.c6
-rw-r--r--fs/jbd/transaction.c9
-rw-r--r--fs/jffs/intrep.c18
-rw-r--r--fs/jffs2/readinode.c8
-rw-r--r--fs/jffs2/wbuf.c3
-rw-r--r--fs/lockd/clntproc.c3
-rw-r--r--fs/mbcache.c3
-rw-r--r--fs/nfs/delegation.c3
-rw-r--r--fs/nfs/inode.c15
-rw-r--r--fs/nfs/nfs4state.c9
-rw-r--r--fs/nfs/unlink.c3
-rw-r--r--fs/nfsd/export.c6
-rw-r--r--fs/nfsd/nfs4xdr.c9
-rw-r--r--fs/nfsd/nfscache.c3
-rw-r--r--fs/openpromfs/inode.c3
-rw-r--r--fs/udf/udf_sb.h3
-rw-r--r--fs/ufs/super.c14
-rw-r--r--fs/xattr.c9
39 files changed, 137 insertions, 245 deletions
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c
index 01e26f0013ac..a93c2bf94c33 100644
--- a/fs/9p/trans_sock.c
+++ b/fs/9p/trans_sock.c
@@ -269,8 +269,7 @@ static void v9fs_sock_close(struct v9fs_transport *trans)
269 dprintk(DEBUG_TRANS, "socket closed\n"); 269 dprintk(DEBUG_TRANS, "socket closed\n");
270 } 270 }
271 271
272 if (ts) 272 kfree(ts);
273 kfree(ts);
274 273
275 trans->priv = NULL; 274 trans->priv = NULL;
276} 275}
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 9c3080716c92..aaec015a16e4 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -35,8 +35,7 @@ affs_put_super(struct super_block *sb)
35 mark_buffer_dirty(sbi->s_root_bh); 35 mark_buffer_dirty(sbi->s_root_bh);
36 } 36 }
37 37
38 if (sbi->s_prefix) 38 kfree(sbi->s_prefix);
39 kfree(sbi->s_prefix);
40 affs_free_bitmap(sb); 39 affs_free_bitmap(sb);
41 affs_brelse(sbi->s_root_bh); 40 affs_brelse(sbi->s_root_bh);
42 kfree(sbi); 41 kfree(sbi);
@@ -198,10 +197,9 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
198 *mount_opts |= SF_MUFS; 197 *mount_opts |= SF_MUFS;
199 break; 198 break;
200 case Opt_prefix: 199 case Opt_prefix:
201 if (*prefix) { /* Free any previous prefix */ 200 /* Free any previous prefix */
202 kfree(*prefix); 201 kfree(*prefix);
203 *prefix = NULL; 202 *prefix = NULL;
204 }
205 *prefix = match_strdup(&args[0]); 203 *prefix = match_strdup(&args[0]);
206 if (!*prefix) 204 if (!*prefix)
207 return 0; 205 return 0;
@@ -462,11 +460,9 @@ got_root:
462out_error: 460out_error:
463 if (root_inode) 461 if (root_inode)
464 iput(root_inode); 462 iput(root_inode);
465 if (sbi->s_bitmap) 463 kfree(sbi->s_bitmap);
466 kfree(sbi->s_bitmap);
467 affs_brelse(root_bh); 464 affs_brelse(root_bh);
468 if (sbi->s_prefix) 465 kfree(sbi->s_prefix);
469 kfree(sbi->s_prefix);
470 kfree(sbi); 466 kfree(sbi);
471 sb->s_fs_info = NULL; 467 sb->s_fs_info = NULL;
472 return -EINVAL; 468 return -EINVAL;
diff --git a/fs/afs/file.c b/fs/afs/file.c
index f53971a543b2..150b19227922 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -265,8 +265,7 @@ static int afs_file_releasepage(struct page *page, gfp_t gfp_flags)
265 set_page_private(page, 0); 265 set_page_private(page, 0);
266 ClearPagePrivate(page); 266 ClearPagePrivate(page);
267 267
268 if (pageio) 268 kfree(pageio);
269 kfree(pageio);
270 } 269 }
271 270
272 _leave(" = 0"); 271 _leave(" = 0");
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
index 1fcaa1568541..633f628005b4 100644
--- a/fs/autofs/waitq.c
+++ b/fs/autofs/waitq.c
@@ -150,10 +150,8 @@ int autofs_wait(struct autofs_sb_info *sbi, struct qstr *name)
150 if ( sbi->catatonic ) { 150 if ( sbi->catatonic ) {
151 /* We might have slept, so check again for catatonic mode */ 151 /* We might have slept, so check again for catatonic mode */
152 wq->status = -ENOENT; 152 wq->status = -ENOENT;
153 if ( wq->name ) { 153 kfree(wq->name);
154 kfree(wq->name); 154 wq->name = NULL;
155 wq->name = NULL;
156 }
157 } 155 }
158 156
159 if ( wq->name ) { 157 if ( wq->name ) {
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 0a3c05d10167..818b37be5153 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -22,10 +22,8 @@
22 22
23static void ino_lnkfree(struct autofs_info *ino) 23static void ino_lnkfree(struct autofs_info *ino)
24{ 24{
25 if (ino->u.symlink) { 25 kfree(ino->u.symlink);
26 kfree(ino->u.symlink); 26 ino->u.symlink = NULL;
27 ino->u.symlink = NULL;
28 }
29} 27}
30 28
31struct autofs_info *autofs4_init_ino(struct autofs_info *ino, 29struct autofs_info *autofs4_init_ino(struct autofs_info *ino,
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 3df86285a1c7..394ff36ef8f1 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -243,10 +243,8 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
243 if ( sbi->catatonic ) { 243 if ( sbi->catatonic ) {
244 /* We might have slept, so check again for catatonic mode */ 244 /* We might have slept, so check again for catatonic mode */
245 wq->status = -ENOENT; 245 wq->status = -ENOENT;
246 if ( wq->name ) { 246 kfree(wq->name);
247 kfree(wq->name); 247 wq->name = NULL;
248 wq->name = NULL;
249 }
250 } 248 }
251 249
252 if ( wq->name ) { 250 if ( wq->name ) {
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index e8112ad5365d..2d365cb8eec6 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -725,20 +725,16 @@ parse_options(char *options, befs_mount_options * opts)
725static void 725static void
726befs_put_super(struct super_block *sb) 726befs_put_super(struct super_block *sb)
727{ 727{
728 if (BEFS_SB(sb)->mount_opts.iocharset) { 728 kfree(BEFS_SB(sb)->mount_opts.iocharset);
729 kfree(BEFS_SB(sb)->mount_opts.iocharset); 729 BEFS_SB(sb)->mount_opts.iocharset = NULL;
730 BEFS_SB(sb)->mount_opts.iocharset = NULL;
731 }
732 730
733 if (BEFS_SB(sb)->nls) { 731 if (BEFS_SB(sb)->nls) {
734 unload_nls(BEFS_SB(sb)->nls); 732 unload_nls(BEFS_SB(sb)->nls);
735 BEFS_SB(sb)->nls = NULL; 733 BEFS_SB(sb)->nls = NULL;
736 } 734 }
737 735
738 if (sb->s_fs_info) { 736 kfree(sb->s_fs_info);
739 kfree(sb->s_fs_info); 737 sb->s_fs_info = NULL;
740 sb->s_fs_info = NULL;
741 }
742 return; 738 return;
743} 739}
744 740
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 6fa6adc40972..f36f2210204f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1006,8 +1006,7 @@ out_free_dentry:
1006 if (interpreter) 1006 if (interpreter)
1007 fput(interpreter); 1007 fput(interpreter);
1008out_free_interp: 1008out_free_interp:
1009 if (elf_interpreter) 1009 kfree(elf_interpreter);
1010 kfree(elf_interpreter);
1011out_free_file: 1010out_free_file:
1012 sys_close(elf_exec_fileno); 1011 sys_close(elf_exec_fileno);
1013out_free_fh: 1012out_free_fh:
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index dda87c4c82a3..e0344f69c79d 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -411,16 +411,11 @@ error:
411 allow_write_access(interpreter); 411 allow_write_access(interpreter);
412 fput(interpreter); 412 fput(interpreter);
413 } 413 }
414 if (interpreter_name) 414 kfree(interpreter_name);
415 kfree(interpreter_name); 415 kfree(exec_params.phdrs);
416 if (exec_params.phdrs) 416 kfree(exec_params.loadmap);
417 kfree(exec_params.phdrs); 417 kfree(interp_params.phdrs);
418 if (exec_params.loadmap) 418 kfree(interp_params.loadmap);
419 kfree(exec_params.loadmap);
420 if (interp_params.phdrs)
421 kfree(interp_params.phdrs);
422 if (interp_params.loadmap)
423 kfree(interp_params.loadmap);
424 return retval; 419 return retval;
425 420
426 /* unrecoverable error - kill the process */ 421 /* unrecoverable error - kill the process */
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index 98539e2afe81..086ae8f4a207 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -553,8 +553,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
553 *(oid + 3))); 553 *(oid + 3)));
554 rc = compare_oid(oid, oidlen, NTLMSSP_OID, 554 rc = compare_oid(oid, oidlen, NTLMSSP_OID,
555 NTLMSSP_OID_LEN); 555 NTLMSSP_OID_LEN);
556 if(oid) 556 kfree(oid);
557 kfree(oid);
558 if (rc) 557 if (rc)
559 use_ntlmssp = TRUE; 558 use_ntlmssp = TRUE;
560 } 559 }
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d74367a08d51..450ab75d6546 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1265,8 +1265,7 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
1265 the helper that resolves tcp names, mount to it, try to 1265 the helper that resolves tcp names, mount to it, try to
1266 tcon to it unmount it if fail */ 1266 tcon to it unmount it if fail */
1267 1267
1268 if(referrals) 1268 kfree(referrals);
1269 kfree(referrals);
1270 1269
1271 return rc; 1270 return rc;
1272} 1271}
@@ -1535,10 +1534,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1535 1534
1536 memset(&volume_info,0,sizeof(struct smb_vol)); 1535 memset(&volume_info,0,sizeof(struct smb_vol));
1537 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { 1536 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
1538 if(volume_info.UNC) 1537 kfree(volume_info.UNC);
1539 kfree(volume_info.UNC); 1538 kfree(volume_info.password);
1540 if(volume_info.password)
1541 kfree(volume_info.password);
1542 FreeXid(xid); 1539 FreeXid(xid);
1543 return -EINVAL; 1540 return -EINVAL;
1544 } 1541 }
@@ -1551,10 +1548,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1551 cifserror("No username specified "); 1548 cifserror("No username specified ");
1552 /* In userspace mount helper we can get user name from alternate 1549 /* In userspace mount helper we can get user name from alternate
1553 locations such as env variables and files on disk */ 1550 locations such as env variables and files on disk */
1554 if(volume_info.UNC) 1551 kfree(volume_info.UNC);
1555 kfree(volume_info.UNC); 1552 kfree(volume_info.password);
1556 if(volume_info.password)
1557 kfree(volume_info.password);
1558 FreeXid(xid); 1553 FreeXid(xid);
1559 return -EINVAL; 1554 return -EINVAL;
1560 } 1555 }
@@ -1573,10 +1568,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1573 1568
1574 if(rc <= 0) { 1569 if(rc <= 0) {
1575 /* we failed translating address */ 1570 /* we failed translating address */
1576 if(volume_info.UNC) 1571 kfree(volume_info.UNC);
1577 kfree(volume_info.UNC); 1572 kfree(volume_info.password);
1578 if(volume_info.password)
1579 kfree(volume_info.password);
1580 FreeXid(xid); 1573 FreeXid(xid);
1581 return -EINVAL; 1574 return -EINVAL;
1582 } 1575 }
@@ -1587,19 +1580,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1587 } else if (volume_info.UNCip){ 1580 } else if (volume_info.UNCip){
1588 /* BB using ip addr as server name connect to the DFS root below */ 1581 /* BB using ip addr as server name connect to the DFS root below */
1589 cERROR(1,("Connecting to DFS root not implemented yet")); 1582 cERROR(1,("Connecting to DFS root not implemented yet"));
1590 if(volume_info.UNC) 1583 kfree(volume_info.UNC);
1591 kfree(volume_info.UNC); 1584 kfree(volume_info.password);
1592 if(volume_info.password)
1593 kfree(volume_info.password);
1594 FreeXid(xid); 1585 FreeXid(xid);
1595 return -EINVAL; 1586 return -EINVAL;
1596 } else /* which servers DFS root would we conect to */ { 1587 } else /* which servers DFS root would we conect to */ {
1597 cERROR(1, 1588 cERROR(1,
1598 ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); 1589 ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified "));
1599 if(volume_info.UNC) 1590 kfree(volume_info.UNC);
1600 kfree(volume_info.UNC); 1591 kfree(volume_info.password);
1601 if(volume_info.password)
1602 kfree(volume_info.password);
1603 FreeXid(xid); 1592 FreeXid(xid);
1604 return -EINVAL; 1593 return -EINVAL;
1605 } 1594 }
@@ -1612,10 +1601,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1612 cifs_sb->local_nls = load_nls(volume_info.iocharset); 1601 cifs_sb->local_nls = load_nls(volume_info.iocharset);
1613 if(cifs_sb->local_nls == NULL) { 1602 if(cifs_sb->local_nls == NULL) {
1614 cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset)); 1603 cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset));
1615 if(volume_info.UNC) 1604 kfree(volume_info.UNC);
1616 kfree(volume_info.UNC); 1605 kfree(volume_info.password);
1617 if(volume_info.password)
1618 kfree(volume_info.password);
1619 FreeXid(xid); 1606 FreeXid(xid);
1620 return -ELIBACC; 1607 return -ELIBACC;
1621 } 1608 }
@@ -1630,10 +1617,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1630 &sin_server6.sin6_addr, 1617 &sin_server6.sin6_addr,
1631 volume_info.username, &srvTcp); 1618 volume_info.username, &srvTcp);
1632 else { 1619 else {
1633 if(volume_info.UNC) 1620 kfree(volume_info.UNC);
1634 kfree(volume_info.UNC); 1621 kfree(volume_info.password);
1635 if(volume_info.password)
1636 kfree(volume_info.password);
1637 FreeXid(xid); 1622 FreeXid(xid);
1638 return -EINVAL; 1623 return -EINVAL;
1639 } 1624 }
@@ -1654,10 +1639,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1654 ("Error connecting to IPv4 socket. Aborting operation")); 1639 ("Error connecting to IPv4 socket. Aborting operation"));
1655 if(csocket != NULL) 1640 if(csocket != NULL)
1656 sock_release(csocket); 1641 sock_release(csocket);
1657 if(volume_info.UNC) 1642 kfree(volume_info.UNC);
1658 kfree(volume_info.UNC); 1643 kfree(volume_info.password);
1659 if(volume_info.password)
1660 kfree(volume_info.password);
1661 FreeXid(xid); 1644 FreeXid(xid);
1662 return rc; 1645 return rc;
1663 } 1646 }
@@ -1666,10 +1649,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1666 if (srvTcp == NULL) { 1649 if (srvTcp == NULL) {
1667 rc = -ENOMEM; 1650 rc = -ENOMEM;
1668 sock_release(csocket); 1651 sock_release(csocket);
1669 if(volume_info.UNC) 1652 kfree(volume_info.UNC);
1670 kfree(volume_info.UNC); 1653 kfree(volume_info.password);
1671 if(volume_info.password)
1672 kfree(volume_info.password);
1673 FreeXid(xid); 1654 FreeXid(xid);
1674 return rc; 1655 return rc;
1675 } else { 1656 } else {
@@ -1692,10 +1673,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1692 if(rc < 0) { 1673 if(rc < 0) {
1693 rc = -ENOMEM; 1674 rc = -ENOMEM;
1694 sock_release(csocket); 1675 sock_release(csocket);
1695 if(volume_info.UNC) 1676 kfree(volume_info.UNC);
1696 kfree(volume_info.UNC); 1677 kfree(volume_info.password);
1697 if(volume_info.password)
1698 kfree(volume_info.password);
1699 FreeXid(xid); 1678 FreeXid(xid);
1700 return rc; 1679 return rc;
1701 } 1680 }
@@ -1710,8 +1689,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1710 if (existingCifsSes) { 1689 if (existingCifsSes) {
1711 pSesInfo = existingCifsSes; 1690 pSesInfo = existingCifsSes;
1712 cFYI(1, ("Existing smb sess found ")); 1691 cFYI(1, ("Existing smb sess found "));
1713 if(volume_info.password) 1692 kfree(volume_info.password);
1714 kfree(volume_info.password);
1715 /* volume_info.UNC freed at end of function */ 1693 /* volume_info.UNC freed at end of function */
1716 } else if (!rc) { 1694 } else if (!rc) {
1717 cFYI(1, ("Existing smb sess not found ")); 1695 cFYI(1, ("Existing smb sess not found "));
@@ -1741,8 +1719,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1741 if(!rc) 1719 if(!rc)
1742 atomic_inc(&srvTcp->socketUseCount); 1720 atomic_inc(&srvTcp->socketUseCount);
1743 } else 1721 } else
1744 if(volume_info.password) 1722 kfree(volume_info.password);
1745 kfree(volume_info.password);
1746 } 1723 }
1747 1724
1748 /* search for existing tcon to this server share */ 1725 /* search for existing tcon to this server share */
@@ -1821,8 +1798,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1821 "", cifs_sb->local_nls, 1798 "", cifs_sb->local_nls,
1822 cifs_sb->mnt_cifs_flags & 1799 cifs_sb->mnt_cifs_flags &
1823 CIFS_MOUNT_MAP_SPECIAL_CHR); 1800 CIFS_MOUNT_MAP_SPECIAL_CHR);
1824 if(volume_info.UNC) 1801 kfree(volume_info.UNC);
1825 kfree(volume_info.UNC);
1826 FreeXid(xid); 1802 FreeXid(xid);
1827 return -ENODEV; 1803 return -ENODEV;
1828 } else { 1804 } else {
@@ -1925,8 +1901,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1925 (in which case it is not needed anymore) but when new sesion is created 1901 (in which case it is not needed anymore) but when new sesion is created
1926 the password ptr is put in the new session structure (in which case the 1902 the password ptr is put in the new session structure (in which case the
1927 password will be freed at unmount time) */ 1903 password will be freed at unmount time) */
1928 if(volume_info.UNC) 1904 kfree(volume_info.UNC);
1929 kfree(volume_info.UNC);
1930 FreeXid(xid); 1905 FreeXid(xid);
1931 return rc; 1906 return rc;
1932} 1907}
@@ -3283,8 +3258,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3283 if ((bcc_ptr + (2 * length)) - 3258 if ((bcc_ptr + (2 * length)) -
3284 pByteArea(smb_buffer_response) <= 3259 pByteArea(smb_buffer_response) <=
3285 BCC(smb_buffer_response)) { 3260 BCC(smb_buffer_response)) {
3286 if(tcon->nativeFileSystem) 3261 kfree(tcon->nativeFileSystem);
3287 kfree(tcon->nativeFileSystem);
3288 tcon->nativeFileSystem = 3262 tcon->nativeFileSystem =
3289 kzalloc(length + 2, GFP_KERNEL); 3263 kzalloc(length + 2, GFP_KERNEL);
3290 cifs_strfromUCS_le(tcon->nativeFileSystem, 3264 cifs_strfromUCS_le(tcon->nativeFileSystem,
@@ -3301,8 +3275,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3301 if ((bcc_ptr + length) - 3275 if ((bcc_ptr + length) -
3302 pByteArea(smb_buffer_response) <= 3276 pByteArea(smb_buffer_response) <=
3303 BCC(smb_buffer_response)) { 3277 BCC(smb_buffer_response)) {
3304 if(tcon->nativeFileSystem) 3278 kfree(tcon->nativeFileSystem);
3305 kfree(tcon->nativeFileSystem);
3306 tcon->nativeFileSystem = 3279 tcon->nativeFileSystem =
3307 kzalloc(length + 1, GFP_KERNEL); 3280 kzalloc(length + 1, GFP_KERNEL);
3308 strncpy(tcon->nativeFileSystem, bcc_ptr, 3281 strncpy(tcon->nativeFileSystem, bcc_ptr,
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index b43e071fe110..0f99aae33162 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -84,10 +84,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
84 cifsInode->time = 0; /* will force revalidate to go get info when needed */ 84 cifsInode->time = 0; /* will force revalidate to go get info when needed */
85 85
86cifs_hl_exit: 86cifs_hl_exit:
87 if (fromName) 87 kfree(fromName);
88 kfree(fromName); 88 kfree(toName);
89 if (toName)
90 kfree(toName);
91 FreeXid(xid); 89 FreeXid(xid);
92 return rc; 90 return rc;
93} 91}
@@ -206,8 +204,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
206 } 204 }
207 } 205 }
208 206
209 if (full_path) 207 kfree(full_path);
210 kfree(full_path);
211 FreeXid(xid); 208 FreeXid(xid);
212 return rc; 209 return rc;
213} 210}
@@ -253,8 +250,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
253 len = buflen; 250 len = buflen;
254 tmpbuffer = kmalloc(len,GFP_KERNEL); 251 tmpbuffer = kmalloc(len,GFP_KERNEL);
255 if(tmpbuffer == NULL) { 252 if(tmpbuffer == NULL) {
256 if (full_path) 253 kfree(full_path);
257 kfree(full_path);
258 FreeXid(xid); 254 FreeXid(xid);
259 return -ENOMEM; 255 return -ENOMEM;
260 } 256 }
@@ -303,8 +299,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
303 strncpy(tmpbuffer, referrals, len-1); 299 strncpy(tmpbuffer, referrals, len-1);
304 } 300 }
305 } 301 }
306 if(referrals) 302 kfree(referrals);
307 kfree(referrals);
308 kfree(tmp_path); 303 kfree(tmp_path);
309} 304}
310 /* BB add code like else decode referrals then memcpy to 305 /* BB add code like else decode referrals then memcpy to
@@ -323,12 +318,8 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
323 rc)); 318 rc));
324 } 319 }
325 320
326 if (tmpbuffer) { 321 kfree(tmpbuffer);
327 kfree(tmpbuffer); 322 kfree(full_path);
328 }
329 if (full_path) {
330 kfree(full_path);
331 }
332 FreeXid(xid); 323 FreeXid(xid);
333 return rc; 324 return rc;
334} 325}
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index eba1de917f2a..34a06692e4fa 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -98,14 +98,10 @@ sesInfoFree(struct cifsSesInfo *buf_to_free)
98 atomic_dec(&sesInfoAllocCount); 98 atomic_dec(&sesInfoAllocCount);
99 list_del(&buf_to_free->cifsSessionList); 99 list_del(&buf_to_free->cifsSessionList);
100 write_unlock(&GlobalSMBSeslock); 100 write_unlock(&GlobalSMBSeslock);
101 if (buf_to_free->serverOS) 101 kfree(buf_to_free->serverOS);
102 kfree(buf_to_free->serverOS); 102 kfree(buf_to_free->serverDomain);
103 if (buf_to_free->serverDomain) 103 kfree(buf_to_free->serverNOS);
104 kfree(buf_to_free->serverDomain); 104 kfree(buf_to_free->password);
105 if (buf_to_free->serverNOS)
106 kfree(buf_to_free->serverNOS);
107 if (buf_to_free->password)
108 kfree(buf_to_free->password);
109 kfree(buf_to_free); 105 kfree(buf_to_free);
110} 106}
111 107
@@ -144,8 +140,7 @@ tconInfoFree(struct cifsTconInfo *buf_to_free)
144 atomic_dec(&tconInfoAllocCount); 140 atomic_dec(&tconInfoAllocCount);
145 list_del(&buf_to_free->cifsConnectionList); 141 list_del(&buf_to_free->cifsConnectionList);
146 write_unlock(&GlobalSMBSeslock); 142 write_unlock(&GlobalSMBSeslock);
147 if (buf_to_free->nativeFileSystem) 143 kfree(buf_to_free->nativeFileSystem);
148 kfree(buf_to_free->nativeFileSystem);
149 kfree(buf_to_free); 144 kfree(buf_to_free);
150} 145}
151 146
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index c1e02eff1d25..f375f87c7dbd 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -87,8 +87,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
87 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 87 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
88 } 88 }
89remove_ea_exit: 89remove_ea_exit:
90 if (full_path) 90 kfree(full_path);
91 kfree(full_path);
92 FreeXid(xid); 91 FreeXid(xid);
93#endif 92#endif
94 return rc; 93 return rc;
@@ -132,8 +131,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
132 returns as xattrs */ 131 returns as xattrs */
133 if(value_size > MAX_EA_VALUE_SIZE) { 132 if(value_size > MAX_EA_VALUE_SIZE) {
134 cFYI(1,("size of EA value too large")); 133 cFYI(1,("size of EA value too large"));
135 if(full_path) 134 kfree(full_path);
136 kfree(full_path);
137 FreeXid(xid); 135 FreeXid(xid);
138 return -EOPNOTSUPP; 136 return -EOPNOTSUPP;
139 } 137 }
@@ -195,8 +193,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
195 } 193 }
196 194
197set_ea_exit: 195set_ea_exit:
198 if (full_path) 196 kfree(full_path);
199 kfree(full_path);
200 FreeXid(xid); 197 FreeXid(xid);
201#endif 198#endif
202 return rc; 199 return rc;
@@ -298,8 +295,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
298 rc = -EOPNOTSUPP; 295 rc = -EOPNOTSUPP;
299 296
300get_ea_exit: 297get_ea_exit:
301 if (full_path) 298 kfree(full_path);
302 kfree(full_path);
303 FreeXid(xid); 299 FreeXid(xid);
304#endif 300#endif
305 return rc; 301 return rc;
@@ -345,8 +341,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
345 cifs_sb->mnt_cifs_flags & 341 cifs_sb->mnt_cifs_flags &
346 CIFS_MOUNT_MAP_SPECIAL_CHR); 342 CIFS_MOUNT_MAP_SPECIAL_CHR);
347 343
348 if (full_path) 344 kfree(full_path);
349 kfree(full_path);
350 FreeXid(xid); 345 FreeXid(xid);
351#endif 346#endif
352 return rc; 347 return rc;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 43dbcb0b21eb..4909754ea84a 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -2235,7 +2235,8 @@ static int fd_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
2235 if (err) 2235 if (err)
2236 err = -EFAULT; 2236 err = -EFAULT;
2237 2237
2238out: if (karg) kfree(karg); 2238out:
2239 kfree(karg);
2239 return err; 2240 return err;
2240} 2241}
2241 2242
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
index 8b679b67e5e0..1274422a5384 100644
--- a/fs/devfs/base.c
+++ b/fs/devfs/base.c
@@ -2738,10 +2738,8 @@ static int devfsd_close(struct inode *inode, struct file *file)
2738 entry = fs_info->devfsd_first_event; 2738 entry = fs_info->devfsd_first_event;
2739 fs_info->devfsd_first_event = NULL; 2739 fs_info->devfsd_first_event = NULL;
2740 fs_info->devfsd_last_event = NULL; 2740 fs_info->devfsd_last_event = NULL;
2741 if (fs_info->devfsd_info) { 2741 kfree(fs_info->devfsd_info);
2742 kfree(fs_info->devfsd_info); 2742 fs_info->devfsd_info = NULL;
2743 fs_info->devfsd_info = NULL;
2744 }
2745 spin_unlock(&fs_info->devfsd_buffer_lock); 2743 spin_unlock(&fs_info->devfsd_buffer_lock);
2746 fs_info->devfsd_pgrp = 0; 2744 fs_info->devfsd_pgrp = 0;
2747 fs_info->devfsd_task = NULL; 2745 fs_info->devfsd_task = NULL;
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 213148c36ebe..6af2f4130290 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -194,8 +194,7 @@ ext2_get_acl(struct inode *inode, int type)
194 acl = NULL; 194 acl = NULL;
195 else 195 else
196 acl = ERR_PTR(retval); 196 acl = ERR_PTR(retval);
197 if (value) 197 kfree(value);
198 kfree(value);
199 198
200 if (!IS_ERR(acl)) { 199 if (!IS_ERR(acl)) {
201 switch(type) { 200 switch(type) {
@@ -262,8 +261,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
262 261
263 error = ext2_xattr_set(inode, name_index, "", value, size, 0); 262 error = ext2_xattr_set(inode, name_index, "", value, size, 0);
264 263
265 if (value) 264 kfree(value);
266 kfree(value);
267 if (!error) { 265 if (!error) {
268 switch(type) { 266 switch(type) {
269 case ACL_TYPE_ACCESS: 267 case ACL_TYPE_ACCESS:
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index dd7113106269..a33fb1d91373 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -294,8 +294,7 @@ static void hostfs_delete_inode(struct inode *inode)
294 294
295static void hostfs_destroy_inode(struct inode *inode) 295static void hostfs_destroy_inode(struct inode *inode)
296{ 296{
297 if(HOSTFS_I(inode)->host_filename) 297 kfree(HOSTFS_I(inode)->host_filename);
298 kfree(HOSTFS_I(inode)->host_filename);
299 298
300 /*XXX: This should not happen, probably. The check is here for 299 /*XXX: This should not happen, probably. The check is here for
301 * additional safety.*/ 300 * additional safety.*/
diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c
index 1d21307730a8..229ff2fb1809 100644
--- a/fs/hpfs/dnode.c
+++ b/fs/hpfs/dnode.c
@@ -244,12 +244,12 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
244 go_up: 244 go_up:
245 if (namelen >= 256) { 245 if (namelen >= 256) {
246 hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen); 246 hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen);
247 if (nd) kfree(nd); 247 kfree(nd);
248 kfree(nname); 248 kfree(nname);
249 return 1; 249 return 1;
250 } 250 }
251 if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) { 251 if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) {
252 if (nd) kfree(nd); 252 kfree(nd);
253 kfree(nname); 253 kfree(nname);
254 return 1; 254 return 1;
255 } 255 }
@@ -257,7 +257,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
257 if (hpfs_sb(i->i_sb)->sb_chk) 257 if (hpfs_sb(i->i_sb)->sb_chk)
258 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) { 258 if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) {
259 hpfs_brelse4(&qbh); 259 hpfs_brelse4(&qbh);
260 if (nd) kfree(nd); 260 kfree(nd);
261 kfree(nname); 261 kfree(nname);
262 return 1; 262 return 1;
263 } 263 }
@@ -270,7 +270,7 @@ static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,
270 for_all_poss(i, hpfs_pos_subst, 5, t + 1); 270 for_all_poss(i, hpfs_pos_subst, 5, t + 1);
271 hpfs_mark_4buffers_dirty(&qbh); 271 hpfs_mark_4buffers_dirty(&qbh);
272 hpfs_brelse4(&qbh); 272 hpfs_brelse4(&qbh);
273 if (nd) kfree(nd); 273 kfree(nd);
274 kfree(nname); 274 kfree(nname);
275 return 0; 275 return 0;
276 } 276 }
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 8eefa6366db7..63e88d7e2c3b 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -75,7 +75,7 @@ void hpfs_error(struct super_block *s, char *m,...)
75 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); 75 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n");
76 else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); 76 else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n");
77 } else printk("\n"); 77 } else printk("\n");
78 if (buf) kfree(buf); 78 kfree(buf);
79 hpfs_sb(s)->sb_was_error = 1; 79 hpfs_sb(s)->sb_was_error = 1;
80} 80}
81 81
@@ -102,8 +102,8 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
102static void hpfs_put_super(struct super_block *s) 102static void hpfs_put_super(struct super_block *s)
103{ 103{
104 struct hpfs_sb_info *sbi = hpfs_sb(s); 104 struct hpfs_sb_info *sbi = hpfs_sb(s);
105 if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); 105 kfree(sbi->sb_cp_table);
106 if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir); 106 kfree(sbi->sb_bmp_dir);
107 unmark_dirty(s); 107 unmark_dirty(s);
108 s->s_fs_info = NULL; 108 s->s_fs_info = NULL;
109 kfree(sbi); 109 kfree(sbi);
@@ -654,8 +654,8 @@ bail3: brelse(bh1);
654bail2: brelse(bh0); 654bail2: brelse(bh0);
655bail1: 655bail1:
656bail0: 656bail0:
657 if (sbi->sb_bmp_dir) kfree(sbi->sb_bmp_dir); 657 kfree(sbi->sb_bmp_dir);
658 if (sbi->sb_cp_table) kfree(sbi->sb_cp_table); 658 kfree(sbi->sb_cp_table);
659 s->s_fs_info = NULL; 659 s->s_fs_info = NULL;
660 kfree(sbi); 660 kfree(sbi);
661 return -EINVAL; 661 return -EINVAL;
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 1652de1b6cb9..298f08be22d4 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -855,8 +855,7 @@ root_found:
855 if (opt.check == 'r') table++; 855 if (opt.check == 'r') table++;
856 s->s_root->d_op = &isofs_dentry_ops[table]; 856 s->s_root->d_op = &isofs_dentry_ops[table];
857 857
858 if (opt.iocharset) 858 kfree(opt.iocharset);
859 kfree(opt.iocharset);
860 859
861 return 0; 860 return 0;
862 861
@@ -895,8 +894,7 @@ out_unknown_format:
895out_freebh: 894out_freebh:
896 brelse(bh); 895 brelse(bh);
897out_freesbi: 896out_freesbi:
898 if (opt.iocharset) 897 kfree(opt.iocharset);
899 kfree(opt.iocharset);
900 kfree(sbi); 898 kfree(sbi);
901 s->s_fs_info = NULL; 899 s->s_fs_info = NULL;
902 return -EINVAL; 900 return -EINVAL;
@@ -1164,8 +1162,7 @@ out_nomem:
1164 1162
1165out_noread: 1163out_noread:
1166 printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block); 1164 printk(KERN_INFO "ISOFS: unable to read i-node block %lu\n", block);
1167 if (tmpde) 1165 kfree(tmpde);
1168 kfree(tmpde);
1169 return -EIO; 1166 return -EIO;
1170 1167
1171out_toomany: 1168out_toomany:
@@ -1334,8 +1331,7 @@ static void isofs_read_inode(struct inode *inode)
1334 init_special_inode(inode, inode->i_mode, inode->i_rdev); 1331 init_special_inode(inode, inode->i_mode, inode->i_rdev);
1335 1332
1336out: 1333out:
1337 if (tmpde) 1334 kfree(tmpde);
1338 kfree(tmpde);
1339 if (bh) 1335 if (bh)
1340 brelse(bh); 1336 brelse(bh);
1341 return; 1337 return;
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index 2a3e310f79ef..002ad2bbc769 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -261,10 +261,8 @@ void journal_commit_transaction(journal_t *journal)
261 struct buffer_head *bh = jh2bh(jh); 261 struct buffer_head *bh = jh2bh(jh);
262 262
263 jbd_lock_bh_state(bh); 263 jbd_lock_bh_state(bh);
264 if (jh->b_committed_data) { 264 kfree(jh->b_committed_data);
265 kfree(jh->b_committed_data); 265 jh->b_committed_data = NULL;
266 jh->b_committed_data = NULL;
267 }
268 jbd_unlock_bh_state(bh); 266 jbd_unlock_bh_state(bh);
269 } 267 }
270 journal_refile_buffer(journal, jh); 268 journal_refile_buffer(journal, jh);
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 13cb05bf6048..429f4b263cf1 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -227,8 +227,7 @@ repeat_locked:
227 spin_unlock(&transaction->t_handle_lock); 227 spin_unlock(&transaction->t_handle_lock);
228 spin_unlock(&journal->j_state_lock); 228 spin_unlock(&journal->j_state_lock);
229out: 229out:
230 if (new_transaction) 230 kfree(new_transaction);
231 kfree(new_transaction);
232 return ret; 231 return ret;
233} 232}
234 233
@@ -725,8 +724,7 @@ done:
725 journal_cancel_revoke(handle, jh); 724 journal_cancel_revoke(handle, jh);
726 725
727out: 726out:
728 if (frozen_buffer) 727 kfree(frozen_buffer);
729 kfree(frozen_buffer);
730 728
731 JBUFFER_TRACE(jh, "exit"); 729 JBUFFER_TRACE(jh, "exit");
732 return error; 730 return error;
@@ -905,8 +903,7 @@ repeat:
905 jbd_unlock_bh_state(bh); 903 jbd_unlock_bh_state(bh);
906out: 904out:
907 journal_put_journal_head(jh); 905 journal_put_journal_head(jh);
908 if (committed_data) 906 kfree(committed_data);
909 kfree(committed_data);
910 return err; 907 return err;
911} 908}
912 909
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c
index 27f199e94cfc..b2e95421d932 100644
--- a/fs/jffs/intrep.c
+++ b/fs/jffs/intrep.c
@@ -462,7 +462,7 @@ jffs_checksum_flash(struct mtd_info *mtd, loff_t start, int size, __u32 *result)
462 } 462 }
463 463
464 /* Free read buffer */ 464 /* Free read buffer */
465 kfree (read_buf); 465 kfree(read_buf);
466 466
467 /* Return result */ 467 /* Return result */
468 D3(printk("checksum result: 0x%08x\n", sum)); 468 D3(printk("checksum result: 0x%08x\n", sum));
@@ -1011,12 +1011,12 @@ jffs_scan_flash(struct jffs_control *c)
1011 offset , fmc->sector_size); 1011 offset , fmc->sector_size);
1012 1012
1013 flash_safe_release(fmc->mtd); 1013 flash_safe_release(fmc->mtd);
1014 kfree (read_buf); 1014 kfree(read_buf);
1015 return -1; /* bad, bad, bad! */ 1015 return -1; /* bad, bad, bad! */
1016 1016
1017 } 1017 }
1018 flash_safe_release(fmc->mtd); 1018 flash_safe_release(fmc->mtd);
1019 kfree (read_buf); 1019 kfree(read_buf);
1020 1020
1021 return -EAGAIN; /* erased offending sector. Try mount one more time please. */ 1021 return -EAGAIN; /* erased offending sector. Try mount one more time please. */
1022 } 1022 }
@@ -1112,7 +1112,7 @@ jffs_scan_flash(struct jffs_control *c)
1112 if (!node) { 1112 if (!node) {
1113 if (!(node = jffs_alloc_node())) { 1113 if (!(node = jffs_alloc_node())) {
1114 /* Free read buffer */ 1114 /* Free read buffer */
1115 kfree (read_buf); 1115 kfree(read_buf);
1116 1116
1117 /* Release the flash device */ 1117 /* Release the flash device */
1118 flash_safe_release(fmc->mtd); 1118 flash_safe_release(fmc->mtd);
@@ -1269,7 +1269,7 @@ jffs_scan_flash(struct jffs_control *c)
1269 DJM(no_jffs_node--); 1269 DJM(no_jffs_node--);
1270 1270
1271 /* Free read buffer */ 1271 /* Free read buffer */
1272 kfree (read_buf); 1272 kfree(read_buf);
1273 1273
1274 /* Release the flash device */ 1274 /* Release the flash device */
1275 flash_safe_release(fmc->mtd); 1275 flash_safe_release(fmc->mtd);
@@ -1296,7 +1296,7 @@ jffs_scan_flash(struct jffs_control *c)
1296 flash_safe_release(fmc->flash_part); 1296 flash_safe_release(fmc->flash_part);
1297 1297
1298 /* Free read buffer */ 1298 /* Free read buffer */
1299 kfree (read_buf); 1299 kfree(read_buf);
1300 1300
1301 return -ENOMEM; 1301 return -ENOMEM;
1302 } 1302 }
@@ -1324,7 +1324,7 @@ jffs_scan_flash(struct jffs_control *c)
1324 jffs_build_end(fmc); 1324 jffs_build_end(fmc);
1325 1325
1326 /* Free read buffer */ 1326 /* Free read buffer */
1327 kfree (read_buf); 1327 kfree(read_buf);
1328 1328
1329 if(!num_free_space){ 1329 if(!num_free_space){
1330 printk(KERN_WARNING "jffs_scan_flash(): Did not find even a single " 1330 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)
1747 } 1747 }
1748 printk("jffs_find_child(): Didn't find the file \"%s\".\n", 1748 printk("jffs_find_child(): Didn't find the file \"%s\".\n",
1749 (copy ? copy : "")); 1749 (copy ? copy : ""));
1750 if (copy) { 1750 kfree(copy);
1751 kfree(copy);
1752 }
1753 }); 1751 });
1754 1752
1755 return f; 1753 return f;
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 5b2a83599d73..1a96903e3ef3 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -490,7 +490,7 @@ int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
490 up(&f->sem); 490 up(&f->sem);
491 jffs2_do_clear_inode(c, f); 491 jffs2_do_clear_inode(c, f);
492 } 492 }
493 kfree (f); 493 kfree(f);
494 return ret; 494 return ret;
495} 495}
496 496
@@ -742,10 +742,8 @@ void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f)
742 742
743 /* For symlink inodes we us f->dents to store the target path name */ 743 /* For symlink inodes we us f->dents to store the target path name */
744 if (S_ISLNK(OFNI_EDONI_2SFFJ(f)->i_mode)) { 744 if (S_ISLNK(OFNI_EDONI_2SFFJ(f)->i_mode)) {
745 if (f->dents) { 745 kfree(f->dents);
746 kfree(f->dents); 746 f->dents = NULL;
747 f->dents = NULL;
748 }
749 } else { 747 } else {
750 fds = f->dents; 748 fds = f->dents;
751 749
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 316133c626b7..7bc7f2d571f6 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -327,8 +327,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
327 c->wbuf_ofs = ofs + towrite; 327 c->wbuf_ofs = ofs + towrite;
328 memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len); 328 memmove(c->wbuf, rewrite_buf + towrite, c->wbuf_len);
329 /* Don't muck about with c->wbuf_inodes. False positives are harmless. */ 329 /* Don't muck about with c->wbuf_inodes. False positives are harmless. */
330 if (buf) 330 kfree(buf);
331 kfree(buf);
332 } else { 331 } else {
333 /* OK, now we're left with the dregs in whichever buffer we're using */ 332 /* OK, now we're left with the dregs in whichever buffer we're using */
334 if (buf) { 333 if (buf) {
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index 87332f30141b..c5a33648e9fd 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -112,8 +112,7 @@ static struct nlm_lockowner *nlm_find_lockowner(struct nlm_host *host, fl_owner_
112 } 112 }
113 } 113 }
114 spin_unlock(&host->h_lock); 114 spin_unlock(&host->h_lock);
115 if (new != NULL) 115 kfree(new);
116 kfree(new);
117 return res; 116 return res;
118} 117}
119 118
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 298997f17475..0f1e4530670f 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -301,8 +301,7 @@ fail:
301 if (cache) { 301 if (cache) {
302 while (--m >= 0) 302 while (--m >= 0)
303 kfree(cache->c_indexes_hash[m]); 303 kfree(cache->c_indexes_hash[m]);
304 if (cache->c_block_hash) 304 kfree(cache->c_block_hash);
305 kfree(cache->c_block_hash);
306 kfree(cache); 305 kfree(cache);
307 } 306 }
308 return NULL; 307 return NULL;
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index 3976c177a7d0..618a327027b3 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -149,8 +149,7 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
149 } 149 }
150 } 150 }
151 spin_unlock(&clp->cl_lock); 151 spin_unlock(&clp->cl_lock);
152 if (delegation != NULL) 152 kfree(delegation);
153 kfree(delegation);
154 return status; 153 return status;
155} 154}
156 155
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 24d2fbf549bd..6391d8964214 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1688,8 +1688,7 @@ static void nfs_kill_super(struct super_block *s)
1688 1688
1689 rpciod_down(); /* release rpciod */ 1689 rpciod_down(); /* release rpciod */
1690 1690
1691 if (server->hostname != NULL) 1691 kfree(server->hostname);
1692 kfree(server->hostname);
1693 kfree(server); 1692 kfree(server);
1694} 1693}
1695 1694
@@ -1908,8 +1907,7 @@ nfs_copy_user_string(char *dst, struct nfs_string *src, int maxlen)
1908 return ERR_PTR(-ENOMEM); 1907 return ERR_PTR(-ENOMEM);
1909 } 1908 }
1910 if (copy_from_user(dst, src->data, maxlen)) { 1909 if (copy_from_user(dst, src->data, maxlen)) {
1911 if (p != NULL) 1910 kfree(p);
1912 kfree(p);
1913 return ERR_PTR(-EFAULT); 1911 return ERR_PTR(-EFAULT);
1914 } 1912 }
1915 dst[maxlen] = '\0'; 1913 dst[maxlen] = '\0';
@@ -2000,10 +1998,8 @@ static struct super_block *nfs4_get_sb(struct file_system_type *fs_type,
2000out_err: 1998out_err:
2001 s = (struct super_block *)p; 1999 s = (struct super_block *)p;
2002out_free: 2000out_free:
2003 if (server->mnt_path) 2001 kfree(server->mnt_path);
2004 kfree(server->mnt_path); 2002 kfree(server->hostname);
2005 if (server->hostname)
2006 kfree(server->hostname);
2007 kfree(server); 2003 kfree(server);
2008 return s; 2004 return s;
2009} 2005}
@@ -2023,8 +2019,7 @@ static void nfs4_kill_super(struct super_block *sb)
2023 2019
2024 destroy_nfsv4_state(server); 2020 destroy_nfsv4_state(server);
2025 2021
2026 if (server->hostname != NULL) 2022 kfree(server->hostname);
2027 kfree(server->hostname);
2028 kfree(server); 2023 kfree(server);
2029} 2024}
2030 2025
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 52a26baa114c..0675f3215e0a 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -69,10 +69,8 @@ init_nfsv4_state(struct nfs_server *server)
69void 69void
70destroy_nfsv4_state(struct nfs_server *server) 70destroy_nfsv4_state(struct nfs_server *server)
71{ 71{
72 if (server->mnt_path) { 72 kfree(server->mnt_path);
73 kfree(server->mnt_path); 73 server->mnt_path = NULL;
74 server->mnt_path = NULL;
75 }
76 if (server->nfs4_state) { 74 if (server->nfs4_state) {
77 nfs4_put_client(server->nfs4_state); 75 nfs4_put_client(server->nfs4_state);
78 server->nfs4_state = NULL; 76 server->nfs4_state = NULL;
@@ -311,8 +309,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct
311 new = NULL; 309 new = NULL;
312 } 310 }
313 spin_unlock(&clp->cl_lock); 311 spin_unlock(&clp->cl_lock);
314 if (new) 312 kfree(new);
315 kfree(new);
316 if (sp != NULL) 313 if (sp != NULL)
317 return sp; 314 return sp;
318 put_rpccred(cred); 315 put_rpccred(cred);
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index f732541a3332..d639d172d568 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -52,8 +52,7 @@ nfs_put_unlinkdata(struct nfs_unlinkdata *data)
52{ 52{
53 if (--data->count == 0) { 53 if (--data->count == 0) {
54 nfs_detach_unlinkdata(data); 54 nfs_detach_unlinkdata(data);
55 if (data->name.name != NULL) 55 kfree(data->name.name);
56 kfree(data->name.name);
57 kfree(data); 56 kfree(data);
58 } 57 }
59} 58}
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 057aff745506..417ec02df44f 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -190,8 +190,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
190 out: 190 out:
191 if (dom) 191 if (dom)
192 auth_domain_put(dom); 192 auth_domain_put(dom);
193 if (buf) 193 kfree(buf);
194 kfree(buf);
195 return err; 194 return err;
196} 195}
197 196
@@ -428,8 +427,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
428 path_release(&nd); 427 path_release(&nd);
429 if (dom) 428 if (dom)
430 auth_domain_put(dom); 429 auth_domain_put(dom);
431 if (buf) 430 kfree(buf);
432 kfree(buf);
433 return err; 431 return err;
434} 432}
435 433
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 4c4146350236..dcd673186944 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -151,8 +151,7 @@ static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
151 if (nbytes <= sizeof(argp->tmp)) 151 if (nbytes <= sizeof(argp->tmp))
152 p = argp->tmp; 152 p = argp->tmp;
153 else { 153 else {
154 if (argp->tmpp) 154 kfree(argp->tmpp);
155 kfree(argp->tmpp);
156 p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL); 155 p = argp->tmpp = kmalloc(nbytes, GFP_KERNEL);
157 if (!p) 156 if (!p)
158 return NULL; 157 return NULL;
@@ -2476,10 +2475,8 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args)
2476 kfree(args->ops); 2475 kfree(args->ops);
2477 args->ops = args->iops; 2476 args->ops = args->iops;
2478 } 2477 }
2479 if (args->tmpp) { 2478 kfree(args->tmpp);
2480 kfree(args->tmpp); 2479 args->tmpp = NULL;
2481 args->tmpp = NULL;
2482 }
2483 while (args->to_free) { 2480 while (args->to_free) {
2484 struct tmpbuf *tb = args->to_free; 2481 struct tmpbuf *tb = args->to_free;
2485 args->to_free = tb->next; 2482 args->to_free = tb->next;
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 119e4d4495b8..d852ebb538e3 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -93,8 +93,7 @@ nfsd_cache_shutdown(void)
93 93
94 cache_disabled = 1; 94 cache_disabled = 1;
95 95
96 if (hash_list) 96 kfree (hash_list);
97 kfree (hash_list);
98 hash_list = NULL; 97 hash_list = NULL;
99} 98}
100 99
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index 1be11ce96b0f..aeb0106890e4 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -1088,8 +1088,7 @@ static void __exit exit_openprom_fs(void)
1088 unregister_filesystem(&openprom_fs_type); 1088 unregister_filesystem(&openprom_fs_type);
1089 free_pages ((unsigned long)nodes, alloced); 1089 free_pages ((unsigned long)nodes, alloced);
1090 for (i = 0; i < aliases_nodes; i++) 1090 for (i = 0; i < aliases_nodes; i++)
1091 if (alias_names [i]) 1091 kfree (alias_names [i]);
1092 kfree (alias_names [i]);
1093 nodes = NULL; 1092 nodes = NULL;
1094} 1093}
1095 1094
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 0e54922daa09..663669810be6 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -39,8 +39,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
39{\ 39{\
40 if (UDF_SB(X))\ 40 if (UDF_SB(X))\
41 {\ 41 {\
42 if (UDF_SB_PARTMAPS(X))\ 42 kfree(UDF_SB_PARTMAPS(X));\
43 kfree(UDF_SB_PARTMAPS(X));\
44 UDF_SB_PARTMAPS(X) = NULL;\ 43 UDF_SB_PARTMAPS(X) = NULL;\
45 }\ 44 }\
46} 45}
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index f036d694ba5a..54828ebcf1ba 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -472,13 +472,14 @@ static int ufs_read_cylinder_structures (struct super_block *sb) {
472 return 1; 472 return 1;
473 473
474failed: 474failed:
475 if (base) kfree (base); 475 kfree (base);
476 if (sbi->s_ucg) { 476 if (sbi->s_ucg) {
477 for (i = 0; i < uspi->s_ncg; i++) 477 for (i = 0; i < uspi->s_ncg; i++)
478 if (sbi->s_ucg[i]) brelse (sbi->s_ucg[i]); 478 if (sbi->s_ucg[i])
479 brelse (sbi->s_ucg[i]);
479 kfree (sbi->s_ucg); 480 kfree (sbi->s_ucg);
480 for (i = 0; i < UFS_MAX_GROUP_LOADED; i++) 481 for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
481 if (sbi->s_ucpi[i]) kfree (sbi->s_ucpi[i]); 482 kfree (sbi->s_ucpi[i]);
482 } 483 }
483 UFSD(("EXIT (FAILED)\n")) 484 UFSD(("EXIT (FAILED)\n"))
484 return 0; 485 return 0;
@@ -981,9 +982,10 @@ magic_found:
981dalloc_failed: 982dalloc_failed:
982 iput(inode); 983 iput(inode);
983failed: 984failed:
984 if (ubh) ubh_brelse_uspi (uspi); 985 if (ubh)
985 if (uspi) kfree (uspi); 986 ubh_brelse_uspi (uspi);
986 if (sbi) kfree(sbi); 987 kfree (uspi);
988 kfree(sbi);
987 sb->s_fs_info = NULL; 989 sb->s_fs_info = NULL;
988 UFSD(("EXIT (FAILED)\n")) 990 UFSD(("EXIT (FAILED)\n"))
989 return -EINVAL; 991 return -EINVAL;
diff --git a/fs/xattr.c b/fs/xattr.c
index f6e00c0e114f..a9db22557998 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -74,8 +74,7 @@ setxattr(struct dentry *d, char __user *name, void __user *value,
74 } 74 }
75out: 75out:
76 up(&d->d_inode->i_sem); 76 up(&d->d_inode->i_sem);
77 if (kvalue) 77 kfree(kvalue);
78 kfree(kvalue);
79 return error; 78 return error;
80} 79}
81 80
@@ -173,8 +172,7 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size)
173 error = -E2BIG; 172 error = -E2BIG;
174 } 173 }
175out: 174out:
176 if (kvalue) 175 kfree(kvalue);
177 kfree(kvalue);
178 return error; 176 return error;
179} 177}
180 178
@@ -259,8 +257,7 @@ listxattr(struct dentry *d, char __user *list, size_t size)
259 error = -E2BIG; 257 error = -E2BIG;
260 } 258 }
261out: 259out:
262 if (klist) 260 kfree(klist);
263 kfree(klist);
264 return error; 261 return error;
265} 262}
266 263