All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donglin Peng <dolinux.peng@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] seq_file: remove redundant assignment of index to m->index
Date: Sat, 10 Feb 2018 23:59:14 +0800	[thread overview]
Message-ID: <CAErzpmu5o+tLJyY9GqkFEOn=KSs0q9pevCBWcvzpxDyV9RiC_Q@mail.gmail.com> (raw)

There are two redundant assignments in the traverse() function, because
the while loop will break after these two assignments, and after that
the variable index will be assigned to m->index again.

Signed-off-by: Peng Donglin <dolinux.peng@gmail.com>
---
 fs/seq_file.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index eea09f6..2298656 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -120,14 +120,12 @@ static int traverse(struct seq_file *m, loff_t offset)
         if (pos + m->count > offset) {
             m->from = offset - pos;
             m->count -= m->from;
-            m->index = index;
             break;
         }
         pos += m->count;
         m->count = 0;
         if (pos == offset) {
             index++;
-            m->index = index;
             break;
         }
         p = m->op->next(m, p, &index);
-- 
1.9.1

             reply	other threads:[~2018-02-10 15:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10 15:59 Donglin Peng [this message]
2018-02-10 18:04 ` [PATCH] seq_file: remove redundant assignment of index to m->index Joe Perches
2018-02-11  1:02   ` Matthew Wilcox
2018-02-11  5:46     ` Donglin Peng

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='CAErzpmu5o+tLJyY9GqkFEOn=KSs0q9pevCBWcvzpxDyV9RiC_Q@mail.gmail.com' \
    --to=dolinux.peng@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.