lkml.org 
[lkml]   [2005]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] drop pointless NULL pointer checks before calling kfree in fs/udf/
(please keep me on CC)


There's no need to check for NULL pointer before calling kfree(), it
handles NULL just fine by itself.


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

--- linux-2.6.12-rc1-mm3-orig/fs/udf/udf_sb.h 2005-03-02 08:38:20.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/udf/udf_sb.h 2005-03-25 21:58:33.000000000 +0100
@@ -39,8 +39,7 @@ static inline struct udf_sb_info *UDF_SB
{\
if (UDF_SB(X))\
{\
- if (UDF_SB_PARTMAPS(X))\
- kfree(UDF_SB_PARTMAPS(X));\
+ kfree(UDF_SB_PARTMAPS(X));\
UDF_SB_PARTMAPS(X) = NULL;\
}\
}
--- linux-2.6.12-rc1-mm3-orig/fs/ufs/super.c 2005-03-21 23:12:41.000000000 +0100
+++ linux-2.6.12-rc1-mm3/fs/ufs/super.c 2005-03-25 21:59:49.000000000 +0100
@@ -472,13 +472,13 @@ static int ufs_read_cylinder_structures
return 1;

failed:
- if (base) kfree (base);
+ kfree(base);
if (sbi->s_ucg) {
for (i = 0; i < uspi->s_ncg; i++)
if (sbi->s_ucg[i]) brelse (sbi->s_ucg[i]);
- kfree (sbi->s_ucg);
+ kfree(sbi->s_ucg);
for (i = 0; i < UFS_MAX_GROUP_LOADED; i++)
- if (sbi->s_ucpi[i]) kfree (sbi->s_ucpi[i]);
+ kfree(sbi->s_ucpi[i]);
}
UFSD(("EXIT (FAILED)\n"))
return 0;
@@ -982,8 +982,8 @@ dalloc_failed:
iput(inode);
failed:
if (ubh) ubh_brelse_uspi (uspi);
- if (uspi) kfree (uspi);
- if (sbi) kfree(sbi);
+ kfree(uspi);
+ kfree(sbi);
sb->s_fs_info = NULL;
UFSD(("EXIT (FAILED)\n"))
return -EINVAL;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-06 13:30    [W:2.506 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site