Skip to content

Commit 0e7572c

Browse files
ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
3bfa7e1 ("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: 7bccd12 ("ubi: Add debugfs file for tracking PEB state") Signed-off-by: Richard Weinberger <[email protected]>
1 parent 3c3c32f commit 0e7572c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

drivers/mtd/ubi/debug.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos)
393393
{
394394
struct ubi_device *ubi = s->private;
395395

396-
if (*pos == 0)
397-
return SEQ_START_TOKEN;
398-
399396
if (*pos < ubi->peb_count)
400397
return pos;
401398

@@ -409,8 +406,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos)
409406
{
410407
struct ubi_device *ubi = s->private;
411408

412-
if (v == SEQ_START_TOKEN)
413-
return pos;
414409
(*pos)++;
415410

416411
if (*pos < ubi->peb_count)
@@ -432,11 +427,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)
432427
int err;
433428

434429
/* If this is the start, print a header */
435-
if (iter == SEQ_START_TOKEN) {
436-
seq_puts(s,
437-
"physical_block_number\terase_count\tblock_status\tread_status\n");
438-
return 0;
439-
}
430+
if (*block_number == 0)
431+
seq_puts(s, "physical_block_number\terase_count\n");
440432

441433
err = ubi_io_is_bad(ubi, *block_number);
442434
if (err)

0 commit comments

Comments
 (0)