]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[MTD] OneNAND: Free the bad block table when the device is released
authorAdrian Hunter <[ext-adrian.hunter@nokia.com]>
Mon, 22 Jan 2007 08:01:01 +0000 (17:01 +0900)
committerKyungmin Park <kyungmin.park@samsung.com>
Mon, 22 Jan 2007 12:27:56 +0000 (21:27 +0900)
OneNAND does 2 memory allocations for bad block information.
Only one of them was being freed.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
drivers/mtd/onenand/onenand_base.c
drivers/mtd/onenand/onenand_bbt.c

index 0ade23749ee1fb48befac4eef30e2070690a4ac2..0249b4aa0976bd23b88cff784966581509fdaa5b 100644 (file)
@@ -2133,8 +2133,11 @@ void onenand_release(struct mtd_info *mtd)
        del_mtd_device (mtd);
 
        /* Free bad block table memory, if allocated */
-       if (this->bbm)
+       if (this->bbm) {
+               struct bbm_info *bbm = this->bbm;
+               kfree(bbm->bbt);
                kfree(this->bbm);
+       }
        /* Buffer allocated by onenand_scan */
        if (this->options & ONENAND_PAGEBUF_ALLOC)
                kfree(this->page_buf);
index 98f8fd1c637510706676b3d5fff7289496f305d0..90db8f5b1f8494e5e65867f8d60cf32873c43de1 100644 (file)
@@ -168,8 +168,8 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
  * marked good / bad blocks and writes the bad block table(s) to
  * the selected place.
  *
- * The bad block table memory is allocated here. It must be freed
- * by calling the onenand_free_bbt function.
+ * The bad block table memory is allocated here. It is freed
+ * by the onenand_release function.
  *
  */
 int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)