[PATCH] drop pointless NULL pointer checks before calling kfree in fs/udf/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(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 <[email protected]>

--- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux