Commit 0e7572cf authored by Richard Weinberger's avatar Richard Weinberger

ubi: Fix seq_file usage in detailed_erase_block_info debugfs file

3bfa7e14 ("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: 7bccd12d ("ubi: Add debugfs file for tracking PEB state")
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 3c3c32f8
...@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos) ...@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
{ {
struct ubi_device *ubi = s->private; struct ubi_device *ubi = s->private;
if (*pos == 0)
return SEQ_START_TOKEN;
if (*pos < ubi->peb_count) if (*pos < ubi->peb_count)
return pos; return pos;
...@@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *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; struct ubi_device *ubi = s->private;
if (v == SEQ_START_TOKEN)
return pos;
(*pos)++; (*pos)++;
if (*pos < ubi->peb_count) if (*pos < ubi->peb_count)
...@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter) ...@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
int err; int err;
/* If this is the start, print a header */ /* If this is the start, print a header */
if (iter == SEQ_START_TOKEN) { if (*block_number == 0)
seq_puts(s, seq_puts(s, "physical_block_number\terase_count\n");
"physical_block_number\terase_count\tblock_status\tread_status\n");
return 0;
}
err = ubi_io_is_bad(ubi, *block_number); err = ubi_io_is_bad(ubi, *block_number);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment