aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/mtdoops.c17
-rw-r--r--include/linux/mtd/mtd.h2
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 69532a34e563..c8540b8a7fc6 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -221,10 +221,14 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic)
221 hdr[0] = cxt->nextcount; 221 hdr[0] = cxt->nextcount;
222 hdr[1] = MTDOOPS_KERNMSG_MAGIC; 222 hdr[1] = MTDOOPS_KERNMSG_MAGIC;
223 223
224 if (panic) 224 if (panic) {
225 ret = mtd_panic_write(mtd, cxt->nextpage * record_size, 225 ret = mtd_panic_write(mtd, cxt->nextpage * record_size,
226 record_size, &retlen, cxt->oops_buf); 226 record_size, &retlen, cxt->oops_buf);
227 else 227 if (ret == -EOPNOTSUPP) {
228 printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n");
229 return;
230 }
231 } else
228 ret = mtd_write(mtd, cxt->nextpage * record_size, 232 ret = mtd_write(mtd, cxt->nextpage * record_size,
229 record_size, &retlen, cxt->oops_buf); 233 record_size, &retlen, cxt->oops_buf);
230 234
@@ -330,13 +334,8 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper,
330 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); 334 memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy);
331 335
332 /* Panics must be written immediately */ 336 /* Panics must be written immediately */
333 if (reason != KMSG_DUMP_OOPS) { 337 if (reason != KMSG_DUMP_OOPS)
334 if (!cxt->mtd->panic_write) 338 mtdoops_write(cxt, 1);
335 printk(KERN_ERR "mtdoops: Cannot write from panic without panic_write\n");
336 else
337 mtdoops_write(cxt, 1);
338 return;
339 }
340 339
341 /* For other cases, schedule work to write it "nicely" */ 340 /* For other cases, schedule work to write it "nicely" */
342 schedule_work(&cxt->work_write); 341 schedule_work(&cxt->work_write);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 2c2a92247e5a..b72964049cdc 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -311,6 +311,8 @@ static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
311 size_t *retlen, const u_char *buf) 311 size_t *retlen, const u_char *buf)
312{ 312{
313 *retlen = 0; 313 *retlen = 0;
314 if (!mtd->panic_write)
315 return -EOPNOTSUPP;
314 return mtd->panic_write(mtd, to, len, retlen, buf); 316 return mtd->panic_write(mtd, to, len, retlen, buf);
315} 317}
316 318