public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] XFS: remove pointless conditional testing 'nmp' vs NULL in fs/xfs/xfs_rtalloc.c::xfs_growfs_rt()
@ 2006-08-12 22:16 Jesper Juhl
  2006-08-14  1:09 ` Nathan Scott
  0 siblings, 1 reply; 5+ messages in thread
From: Jesper Juhl @ 2006-08-12 22:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: xfs-masters, xfs, nathans, Jesper Juhl

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 <jesper.juhl@gmail.com>
---

 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;
 }



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-17  6:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-12 22:16 [PATCH] XFS: remove pointless conditional testing 'nmp' vs NULL in fs/xfs/xfs_rtalloc.c::xfs_growfs_rt() Jesper Juhl
2006-08-14  1:09 ` Nathan Scott
2006-08-14  7:25   ` Jesper Juhl
2006-08-16 20:44     ` Jesper Juhl
2006-08-17  6:31       ` Nathan Scott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox