aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
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/nfs
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/nfs')
-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
4 files changed, 10 insertions, 20 deletions
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}