misc: apanic: erase kpanic when no data
authorTom Zhu <a2289c@android-hal-04.(none)>
Thu, 24 Sep 2009 15:58:50 +0000 (10:58 -0500)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:19 +0000 (09:09 -0700)
erase kpanic partition when there is no data(console and thread)

Signed-off-by: Tom Zhu <a2289c@android-hal-04.(none)>
Signed-off-by: San Mehat <san@google.com>
drivers/misc/apanic.c

index f50881ba917d85c41c6d82ebb6574f1a1c23cc2d..ca875f89da7a7ffe4dfde8eda532f26c800d50f9 100644 (file)
@@ -297,6 +297,7 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
        struct panic_header *hdr = ctx->bounce;
        size_t len;
        int rc;
+       int    proc_entry_created = 0;
 
        if (strcmp(mtd->name, CONFIG_APANIC_PLABEL))
                return;
@@ -358,6 +359,7 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
                        ctx->apanic_console->write_proc = apanic_proc_write;
                        ctx->apanic_console->size = hdr->console_length;
                        ctx->apanic_console->data = (void *) 1;
+                       proc_entry_created = 1;
                }
        }
 
@@ -372,9 +374,13 @@ static void mtd_panic_notify_add(struct mtd_info *mtd)
                        ctx->apanic_threads->write_proc = apanic_proc_write;
                        ctx->apanic_threads->size = hdr->threads_length;
                        ctx->apanic_threads->data = (void *) 2;
+                       proc_entry_created = 1;
                }
        }
 
+       if (!proc_entry_created)
+               mtd_panic_erase();
+
        return;
 out_err:
        ctx->mtd = NULL;