diff mbox series

mtd: mtdoops: Don't write panic data twice

Message ID 20200903034217.23079-1-mark.tomlinson@alliedtelesis.co.nz
State Accepted
Headers show
Series mtd: mtdoops: Don't write panic data twice | expand

Commit Message

Mark Tomlinson Sept. 3, 2020, 3:42 a.m. UTC
If calling mtdoops_write, don't also schedule work to be done later.

Although this appears to not be causing an issue, possibly because the
scheduled work will never get done, it is confusing.

Fixes: 016c1291ce70 ("mtd: mtdoops: do not use mtd->panic_write directly")
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
---
 drivers/mtd/mtdoops.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Miquel Raynal Sept. 11, 2020, 4:50 p.m. UTC | #1
On Thu, 2020-09-03 at 03:42:17 UTC, Mark Tomlinson wrote:
> If calling mtdoops_write, don't also schedule work to be done later.
> 
> Although this appears to not be causing an issue, possibly because the
> scheduled work will never get done, it is confusing.
> 
> Fixes: 016c1291ce70 ("mtd: mtdoops: do not use mtd->panic_write directly")
> Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 4ced68be7ed7..774970bfcf85 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -279,12 +279,13 @@  static void mtdoops_do_dump(struct kmsg_dumper *dumper,
 	kmsg_dump_get_buffer(dumper, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE,
 			     record_size - MTDOOPS_HEADER_SIZE, NULL);
 
-	/* Panics must be written immediately */
-	if (reason != KMSG_DUMP_OOPS)
+	if (reason != KMSG_DUMP_OOPS) {
+		/* Panics must be written immediately */
 		mtdoops_write(cxt, 1);
-
-	/* For other cases, schedule work to write it "nicely" */
-	schedule_work(&cxt->work_write);
+	} else {
+		/* For other cases, schedule work to write it "nicely" */
+		schedule_work(&cxt->work_write);
+	}
 }
 
 static void mtdoops_notify_add(struct mtd_info *mtd)