Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1177937

Re: [PATCH] ntfs: Deletion of unnecessary checks before the function call "iput"

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] ntfs: Deletion of unnecessary checks before the function call "iput"
Date Tue, 07 Jul 2015 00:00:01 +0200
Message-ID <pJmAF-5kl-9@gated-at.bofh.it> (permalink)
References <mSsDN-4wa-35@gated-at.bofh.it> <mSsDN-4wa-37@gated-at.bofh.it> <mSsDN-4wa-39@gated-at.bofh.it> <mSsDN-4wa-41@gated-at.bofh.it> <mSsDN-4wa-43@gated-at.bofh.it> <mSsDN-4wa-45@gated-at.bofh.it> <mSsDN-4wa-47@gated-at.bofh.it> <mSsDN-4wa-49@gated-at.bofh.it> <mSsDN-4wa-51@gated-at.bofh.it> <mSsDN-4wa-53@gated-at.bofh.it> <mSsDN-4wa-55@gated-at.bofh.it> <mSsDN-4wa-57@gated-at.bofh.it> <mSsDN-4wa-59@gated-at.bofh.it> <mSsDN-4wa-61@gated-at.bofh.it> <mSsDN-4wa-63@gated-at.bofh.it> <mSsDN-4wa-65@gated-at.bofh.it> <mSsDN-4wa-33@gated-at.bofh.it> <omQA1-7vz-5@gated-at.bofh.it> <pINCW-wQ-9@gated-at.bofh.it> <pINCY-wQ-45@gated-at.bofh.it>
X-Original-To Anton Altaparmakov <anton@tuxera.com>
X-Mailer Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 77
Organization linux.* mail to news gateway
X-Original-Cc "linux-ntfs-dev@lists.sourceforge.net" <linux-ntfs-dev@lists.sourceforge.net>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, "kernel-janitors@vger.kernel.org" <kernel-janitors@vger.kernel.org>, Julia Lawall <julia.lawall@lip6.fr>, "SF Markus Elfring" <elfring@users.sourceforge.net>
X-Original-Date Mon, 6 Jul 2015 14:50:13 -0700
X-Original-Message-ID <20150706145013.13e231ec1dc51ac0d9137732@linux-foundation.org>
X-Original-References <5307CAA2.8060406@users.sourceforge.net> <alpine.DEB.2.02.1402212321410.2043@localhost6.localdomain6> <530A086E.8010901@users.sourceforge.net> <alpine.DEB.2.02.1402231635510.1985@localhost6.localdomain6> <530A72AA.3000601@users.sourceforge.net> <alpine.DEB.2.02.1402240658210.2090@localhost6.localdomain6> <530B5FB6.6010207@users.sourceforge.net> <alpine.DEB.2.10.1402241710370.2074@hadrien> <530C5E18.1020800@users.sourceforge.net> <alpine.DEB.2.10.1402251014170.2080@hadrien> <530CD2C4.4050903@users.sourceforge.net> <alpine.DEB.2.10.1402251840450.7035@hadrien> <530CF8FF.8080600@users.sourceforge.net> <alpine.DEB.2.02.1402252117150.2047@localhost6.localdomain6> <530DD06F.4090703@users.sourceforge.net> <alpine.DEB.2.02.1402262129250.2221@localhost6.localdomain6> <5317A59D.4@users.sourceforge.net> <54679E97.5000801@users.sourceforge.net> <5597B641.2030704@users.sourceforge.net> <620065E5-8238-476C-A9B5-1B5B1AD298B0@tuxera.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1177937

Show key headers only | View raw


On Sat, 4 Jul 2015 10:36:57 +0000 Anton Altaparmakov <anton@tuxera.com> wrote:

> Hi Andrew,
> 
> Can you please take up this trivial patch and merge it upstream?
> 
> Reviewed-by: Anton Altaparmakov <anton@tuxera.com>
> 

Nobody responded to Julia's review comment: "I don't have time to look
at the code now, but since there is an exit label here, have you
checked whether you could improve the gotos in these cases?"

She has a good point.  We can either change those gotos to go to the
correct place (current code is rather bizarre) or we can simply do

--- a/fs/ntfs/super.c~a
+++ a/fs/ntfs/super.c
@@ -2202,36 +2202,26 @@ get_ctx_vol_failed:
 	}
 #endif /* NTFS_RW */
 	return true;
+out:
 #ifdef NTFS_RW
-iput_usnjrnl_err_out:
 	iput(vol->usnjrnl_j_ino);
 	iput(vol->usnjrnl_max_ino);
 	iput(vol->usnjrnl_ino);
-iput_quota_err_out:
 	iput(vol->quota_q_ino);
 	iput(vol->quota_ino);
 	iput(vol->extend_ino);
 #endif /* NTFS_RW */
-iput_sec_err_out:
 	iput(vol->secure_ino);
-iput_root_err_out:
 	iput(vol->root_ino);
-iput_logfile_err_out:
 #ifdef NTFS_RW
 	iput(vol->logfile_ino);
-iput_vol_err_out:
 #endif /* NTFS_RW */
 	iput(vol->vol_ino);
-iput_lcnbmp_err_out:
 	iput(vol->lcnbmp_ino);
-iput_attrdef_err_out:
 	vol->attrdef_size = 0;
-	if (vol->attrdef) {
-		ntfs_free(vol->attrdef);
-		vol->attrdef = NULL;
-	}
+	ntfs_free(vol->attrdef);
+	vol->attrdef = NULL;
 #ifdef NTFS_RW
-iput_upcase_err_out:
 #endif /* NTFS_RW */
 	vol->upcase_len = 0;
 	mutex_lock(&ntfs_lock);
@@ -2246,7 +2236,6 @@ iput_upcase_err_out:
 	}
 iput_mftbmp_err_out:
 	iput(vol->mftbmp_ino);
-iput_mirr_err_out:
 #ifdef NTFS_RW
 	iput(vol->mftmirr_ino);
 #endif /* NTFS_RW */

(note that ntfs_free(NULL) is OK)

then change all the appropriate gotos to good old "goto out;".

Or we can not bother ;)
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH] ntfs: Deletion of unnecessary checks before the function  call "iput" SF Markus Elfring <elfring@users.sourceforge.net> - 2015-07-05 10:40 +0200
  Re: [PATCH] ntfs: Deletion of unnecessary checks before the  function call "iput" Anton Altaparmakov <anton@tuxera.com> - 2015-07-05 10:40 +0200
    Re: [PATCH] ntfs: Deletion of unnecessary checks before the  function call "iput" Andrew Morton <akpm@linux-foundation.org> - 2015-07-07 00:00 +0200

csiph-web