From: Richard Weinberger <richard.weinberger@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org, ben.shelton@ni.com,
LKML <linux-kernel@vger.kernel.org>,
zach.brown@ni.com
Subject: Re: [PATCH] ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
Date: Sun, 17 May 2020 23:39:39 +0200 [thread overview]
Message-ID: <CAFLxGvw9Tc9dr+=Dyuut9gXeLfUg2aUROGdZ4-g5=_OtS_hnLA@mail.gmail.com> (raw)
In-Reply-To: <20200502124802.9758-1-richard@nod.at>
On Sat, May 2, 2020 at 2:48 PM Richard Weinberger <richard@nod.at> wrote:
>
> 3bfa7e141b0b ("fs/seq_file.c: seq_read(): add info message about buggy .next functions")
> showed that we don't use seq_file correctly.
> So make sure that our ->next function always updates the position.
>
> Fixes: 7bccd12d27b7 ("ubi: Add debugfs file for tracking PEB state")
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> drivers/mtd/ubi/debug.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
> index 54646c2c2744..ac2bdba8bb1a 100644
> --- a/drivers/mtd/ubi/debug.c
> +++ b/drivers/mtd/ubi/debug.c
> @@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
> {
> struct ubi_device *ubi = s->private;
>
> - if (*pos == 0)
> - return SEQ_START_TOKEN;
> -
> if (*pos < ubi->peb_count)
> return pos;
>
> @@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos)
> {
> struct ubi_device *ubi = s->private;
>
> - if (v == SEQ_START_TOKEN)
> - return pos;
> (*pos)++;
>
> if (*pos < ubi->peb_count)
> @@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
> int err;
>
> /* If this is the start, print a header */
> - if (iter == SEQ_START_TOKEN) {
> - seq_puts(s,
> - "physical_block_number\terase_count\tblock_status\tread_status\n");
> - return 0;
> - }
> + if (*block_number == 0)
> + seq_puts(s, "physical_block_number\terase_count\n");
>
> err = ubi_io_is_bad(ubi, *block_number);
> if (err)
> --
Applied!
--
Thanks,
//richard
prev parent reply other threads:[~2020-05-17 21:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-02 12:48 [PATCH] ubi: Fix seq_file usage in detailed_erase_block_info debugfs file Richard Weinberger
2020-05-17 21:39 ` Richard Weinberger [this message]
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='CAFLxGvw9Tc9dr+=Dyuut9gXeLfUg2aUROGdZ4-g5=_OtS_hnLA@mail.gmail.com' \
--to=richard.weinberger@gmail.com \
--cc=ben.shelton@ni.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=zach.brown@ni.com \
/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;
as well as URLs for NNTP newsgroup(s).