[PATCH 12/12] mtd: nand: free allocated memory

Brian Norris computersforpeace at gmail.com
Tue Aug 30 21:45:47 EDT 2011


This fixes a problem from:

  commit f2f4772692cf3f31eb73d46337c7f10bd031bc26
  mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option

In reverting pieces of another commit, I accidentally removed a line
that shold have stayed. We should free up the memory we allocated upon
releasing our device.

Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
This should probably just be squashed in with the buggy commit (it
hasn't been brought upstream yet...)

 drivers/mtd/nand/nand_base.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index de2d1c4..c9767b5 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3533,6 +3533,11 @@ void nand_release(struct mtd_info *mtd)
 	kfree(chip->bbt);
 	if (!(chip->options & NAND_OWN_BUFFERS))
 		kfree(chip->buffers);
+
+	/* Free bad block descriptor memory */
+	if (chip->badblock_pattern && chip->badblock_pattern->options
+			& NAND_BBT_DYNAMICSTRUCT)
+		kfree(chip->badblock_pattern);
 }
 EXPORT_SYMBOL_GPL(nand_release);
 
-- 
1.7.5.4





More information about the linux-mtd mailing list