mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Mateusz Guzik <mguzik@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] vfs: show_mountinfo: cleanup error code checks
Date: Thu, 19 Nov 2015 00:58:20 +0300	[thread overview]
Message-ID: <20151118215820.GB15460@altlinux.org> (raw)
In-Reply-To: <20151118180213.GA9688@mguzik>

Check err variable right after each assignment.  This change makes
initialization of err redundant, so remove the initialization.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 fs/proc_namespace.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index cbc9c27..7a6b2f3 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -131,16 +131,17 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
 	struct mount *r = real_mount(mnt);
 	struct super_block *sb = mnt->mnt_sb;
 	struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
-	int err = 0;
+	int err;
 
 	seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id,
 		   MAJOR(sb->s_dev), MINOR(sb->s_dev));
-	if (sb->s_op->show_path)
+	if (sb->s_op->show_path) {
 		err = sb->s_op->show_path(m, mnt->mnt_root);
-	else
+		if (err)
+			goto out;
+	} else {
 		seq_dentry(m, mnt->mnt_root, " \t\n\\");
-	if (err)
-		goto out;
+	}
 	seq_putc(m, ' ');
 
 	/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
@@ -168,12 +169,13 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
 	seq_puts(m, " - ");
 	show_type(m, sb);
 	seq_putc(m, ' ');
-	if (sb->s_op->show_devname)
+	if (sb->s_op->show_devname) {
 		err = sb->s_op->show_devname(m, mnt->mnt_root);
-	else
+		if (err)
+			goto out;
+	} else {
 		mangle(m, r->mnt_devname ? r->mnt_devname : "none");
-	if (err)
-		goto out;
+	}
 	seq_puts(m, sb->s_flags & MS_RDONLY ? " ro" : " rw");
 	err = show_sb_opts(m, sb);
 	if (err)

-- 
ldv

  parent reply	other threads:[~2015-11-18 21:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 11:30 [PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
2015-11-18 17:42 ` [RESEND PATCH] " Dmitry V. Levin
2015-11-18 18:02   ` Mateusz Guzik
2015-11-18 21:57     ` [PATCH 1/3] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
2016-01-11 15:36       ` [RESEND PATCH " Dmitry V. Levin
2015-11-18 21:58     ` Dmitry V. Levin [this message]
2016-01-11 15:37       ` [RESEND PATCH 2/3] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
2015-11-18 21:58     ` [PATCH 3/3] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
2016-01-11 15:37       ` [RESEND PATCH " Dmitry V. Levin
2015-12-02 17:20     ` [RESEND v2 PATCH 1/4] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
2015-12-02 17:20     ` [RESEND PATCH 2/4] vfs: show_vfsmnt: remove redundant initialization of error code Dmitry V. Levin
2015-12-02 17:20     ` [RESEND PATCH 3/4] vfs: show_mountinfo: cleanup error code checks Dmitry V. Levin
2015-12-02 17:20     ` [RESEND PATCH 4/4] vfs: show_vfsstat: remove redundant initialization and check of error code Dmitry V. Levin
2016-01-11 15:36   ` [RESEND v2 PATCH] vfs: show_vfsstat: do not ignore errors from show_devname method Dmitry V. Levin
2016-02-19  1:56     ` [RESEND v3 " Dmitry V. Levin
2016-03-16 16:31       ` [RESEND v4 " Dmitry V. Levin
2016-03-16 16:49         ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151118215820.GB15460@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mguzik@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome