Skip to contentSkip to conversation

nfs: remove kfree() redundant null checks

PATCH New Tim Gardner 1 participant 1 message Feb 12, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfs: remove kfree() redundant null checks

smatch analysis:

fs/nfs/getroot.c:130 nfs_get_root() info: redundant null
check on name calling kfree()

fs/nfs/unlink.c:272 nfs_async_unlink() info: redundant null
check on devname_garbage calling kfree()

---
 fs/nfs/getroot.c |    3 +--
 fs/nfs/unlink.c  |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
fs/nfs/getroot.c +1 -2
index 033803c..44efaa8 100644
@@ -126,8 +126,7 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh,
 	}
 	spin_unlock(&ret->d_lock);
 out:
-	if (name)
-		kfree(name);
+	kfree(name);
 	nfs_free_fattr(fsinfo.fattr);
 	return ret;
 }
fs/nfs/unlink.c +1 -2
index 13cea63..d26a32f 100644
@@ -268,8 +268,7 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry)
 	 * point dentry is definitely not a root, so we won't need
 	 * that anymore.
 	 */
-	if (devname_garbage)
-		kfree(devname_garbage);
+	kfree(devname_garbage);
 	return 0;
 out_unlock:
 	spin_unlock(&dentry->d_lock);
Signature · 1 line
1.7.9.5