diff mbox

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

Message ID 1314755147-17756-13-git-send-email-computersforpeace@gmail.com
State New, archived
Headers show

Commit Message

Brian Norris Aug. 31, 2011, 1:45 a.m. UTC
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@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(-)

Comments

Artem Bityutskiy Sept. 11, 2011, 12:07 p.m. UTC | #1
On Tue, 2011-08-30 at 18:45 -0700, Brian Norris wrote:
> This fixes a problem from:
> 
>   commit f2f4772692cf3f31eb73d46337c7f10bd031bc26
>   mtd: nand: remove NAND_BBT_SCANBYTE1AND6 option

Amended that commit, thanks!
diff mbox

Patch

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);