[PATCH] XFS: remove pointless conditional testing 'nmp' vs NULL in fs/xfs/xfs_rtalloc.c::xfs_growfs_rt()

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

 



In fs/xfs/xfs_rtalloc.c::xfs_growfs_rt() there's a completely useless
conditional at the error_exit label.
The 'if (nmp)' check is pointless and might as well be removed for two 
reasons.
1) if 'nmp' is NULL then kmem_free() will end up calling kfree() with a NULL
   argument - which in turn will just cause a return from kfree(). No harm 
   done.
2) At the beginning of the function there's an assignment; '*nmp = *mp;' so
   if 'nmp' was NULL we'd already have blown up due to dereferencing a NULL 
   pointer.

This patch gets rid of the pointless check.


Signed-off-by: Jesper Juhl <[email protected]>
---

 fs/xfs/xfs_rtalloc.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)

--- linux-2.6.18-rc4-orig/fs/xfs/xfs_rtalloc.c	2006-08-11 00:11:13.000000000 +0200
+++ linux-2.6.18-rc4/fs/xfs/xfs_rtalloc.c	2006-08-13 00:07:43.000000000 +0200
@@ -2107,8 +2107,7 @@ xfs_growfs_rt(
 	 * Error paths come here.
 	 */
 error_exit:
-	if (nmp)
-		kmem_free(nmp, sizeof(*nmp));
+	kmem_free(nmp, sizeof(*nmp));
 	xfs_trans_cancel(tp, cancelflags);
 	return error;
 }


-
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