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"

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] ntfs: Deletion of unnecessary checks before the function call "iput"
Date 2015-07-07 00:00 +0200
Message-ID <pJmAF-5kl-9@gated-at.bofh.it> (permalink)
References (15 earlier) <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>
Organization linux.* mail to news gateway

Show all headers | 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