nfs: Remove redundant null checks before kfree
authorYushan Zhou <katrinzhou@tencent.com>
Tue, 18 Oct 2022 04:07:08 +0000 (12:07 +0800)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 27 Oct 2022 19:52:10 +0000 (15:52 -0400)
Fix the following coccicheck warning:
fs/nfs/dir.c:2494:2-7: WARNING:
NULL check before some freeing functions is not needed.

Signed-off-by: Yushan Zhou <katrinzhou@tencent.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/dir.c

index 58036f657126878e54eca3448f10032b26b7320c..f594dac436a7e9fafd7fd8624754dc4dcf0aca23 100644 (file)
@@ -2489,9 +2489,8 @@ int nfs_unlink(struct inode *dir, struct dentry *dentry)
                spin_unlock(&dentry->d_lock);
                goto out;
        }
-       if (dentry->d_fsdata)
-               /* old devname */
-               kfree(dentry->d_fsdata);
+       /* old devname */
+       kfree(dentry->d_fsdata);
        dentry->d_fsdata = NFS_FSDATA_BLOCKED;
 
        spin_unlock(&dentry->d_lock);