Commit f00b0046 authored by Adrian Hunter's avatar Adrian Hunter Committed by Kyungmin Park

[MTD] OneNAND: Free the bad block table when the device is released

OneNAND does 2 memory allocations for bad block information.
Only one of them was being freed.
Signed-off-by: default avatarAdrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
parent 75384b0d
...@@ -2133,8 +2133,11 @@ void onenand_release(struct mtd_info *mtd) ...@@ -2133,8 +2133,11 @@ void onenand_release(struct mtd_info *mtd)
del_mtd_device (mtd); del_mtd_device (mtd);
/* Free bad block table memory, if allocated */ /* 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); kfree(this->bbm);
}
/* Buffer allocated by onenand_scan */ /* Buffer allocated by onenand_scan */
if (this->options & ONENAND_PAGEBUF_ALLOC) if (this->options & ONENAND_PAGEBUF_ALLOC)
kfree(this->page_buf); kfree(this->page_buf);
......
...@@ -168,8 +168,8 @@ static int onenand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt) ...@@ -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 * marked good / bad blocks and writes the bad block table(s) to
* the selected place. * the selected place.
* *
* The bad block table memory is allocated here. It must be freed * The bad block table memory is allocated here. It is freed
* by calling the onenand_free_bbt function. * by the onenand_release function.
* *
*/ */
int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd) int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment