NTFS: Remove checks for NULL before calling kfree() since kfree() does the
Jesper Juhl [Mon, 4 Apr 2005 13:59:56 +0000 (14:59 +0100)]
      checking itself.  (Jesper Juhl)

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

fs/ntfs/ChangeLog
fs/ntfs/dir.c
fs/ntfs/namei.c
fs/ntfs/super.c

index b29e061..51428bf 100644 (file)
@@ -103,6 +103,8 @@ ToDo/Notes:
        - Modify ->readpage and ->writepage (fs/ntfs/aops.c) so they detect and
          handle the case where an attribute is converted from resident to
          non-resident by a concurrent file write.
+       - Remove checks for NULL before calling kfree() since kfree() does the
+         checking itself.  (Jesper Juhl)
 
 2.1.22 - Many bug and race fixes and error handling improvements.
 
index 95c4457..a56ca18 100644 (file)
@@ -183,8 +183,7 @@ found_it:
                                name->len = 0;
                                *res = name;
                        } else {
-                               if (name)
-                                       kfree(name);
+                               kfree(name);
                                *res = NULL;
                        }
                        mref = le64_to_cpu(ie->data.dir.indexed_file);
@@ -444,8 +443,7 @@ found_it2:
                                name->len = 0;
                                *res = name;
                        } else {
-                               if (name)
-                                       kfree(name);
+                               kfree(name);
                                *res = NULL;
                        }
                        mref = le64_to_cpu(ie->data.dir.indexed_file);
@@ -1462,10 +1460,8 @@ err_out:
                unlock_page(ia_page);
                ntfs_unmap_page(ia_page);
        }
-       if (ir)
-               kfree(ir);
-       if (name)
-               kfree(name);
+       kfree(ir);
+       kfree(name);
        if (ctx)
                ntfs_attr_put_search_ctx(ctx);
        if (m)
index d261e25..351dbc3 100644 (file)
@@ -153,8 +153,7 @@ static struct dentry *ntfs_lookup(struct inode *dir_ino, struct dentry *dent,
                        ntfs_error(vol->sb, "ntfs_iget(0x%lx) failed with "
                                        "error code %li.", dent_ino,
                                        PTR_ERR(dent_inode));
-               if (name)
-                       kfree(name);
+               kfree(name);
                /* Return the error code. */
                return (struct dentry *)dent_inode;
        }
index 78416eb..25fa1d1 100644 (file)
@@ -1193,8 +1193,7 @@ static BOOL load_and_init_quota(ntfs_volume *vol)
                return FALSE;
        }
        /* We do not care for the type of match that was found. */
-       if (name)
-               kfree(name);
+       kfree(name);
        /* Get the inode. */
        tmp_ino = ntfs_iget(vol->sb, MREF(mref));
        if (IS_ERR(tmp_ino) || is_bad_inode(tmp_ino)) {