xfs-masters
[Top] [All Lists]

[xfs-masters] [PATCH] XFS: remove pointless conditional testing 'nmp' vs

To: linux-kernel@xxxxxxxxxxxxxxx
Subject: [xfs-masters] [PATCH] XFS: remove pointless conditional testing 'nmp' vs NULL in fs/xfs/xfs_rtalloc.c::xfs_growfs_rt()
From: Jesper Juhl <jesper.juhl@xxxxxxxxx>
Date: Sun, 13 Aug 2006 00:16:50 +0200
Cc: xfs-masters@xxxxxxxxxxx, xfs@xxxxxxxxxxx, nathans@xxxxxxx, Jesper Juhl <jesper.juhl@xxxxxxxxx>
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:to:subject:date:user-agent:cc:mime-version:content-type:content-transfer-encoding:content-disposition:message-id; b=qhsmzidQOaOlncm23hsk/pg1FAQ2muIB3uW2ElgKxwPQB/UgckuTjL52opsnKxCoRbMnJWE1dZo4wWEe+Rev6g3GhAAeGplHn3+0zKbl/VN7PdKjxYd2JFVESFd3Xx/5AxTBN3yi34G3B9V/sah1gO1mQrG+0h8Hizv5Msqu0tE=
Reply-to: xfs-masters@xxxxxxxxxxx
Sender: xfs-masters-bounce@xxxxxxxxxxx
User-agent: KMail/1.9.4
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@xxxxxxxxx>
---

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



<Prev in Thread] Current Thread [Next in Thread>