Patchwork mtd: gpmi: fix a dereferencing freed memory error

login
register
mail settings
Submitter Huang Shijie
Date Jan. 23, 2013, 8:20 a.m.
Message ID <1358929253-29143-1-git-send-email-b32955@freescale.com>
Download mbox | patch
Permalink /patch/214857/
State Accepted
Commit 26738ddb8553f0883c949310337abcf5b353f63d
Headers show

Comments

Huang Shijie - Jan. 23, 2013, 8:20 a.m.
The patch "490e280 mtd: gpmi-nand: Convert to module_platform_driver()"
introduced a "dereferencing freed memory" error.

This patch fixes it.

Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Artem Bityutskiy - Feb. 4, 2013, 8:08 a.m.
On Wed, 2013-01-23 at 16:20 +0800, Huang Shijie wrote:
> The patch "490e280 mtd: gpmi-nand: Convert to module_platform_driver()"
> introduced a "dereferencing freed memory" error.
> 
> This patch fixes it.
> 
> Signed-off-by: Huang Shijie <b32955@freescale.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 631564d..38c8b8b 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1657,8 +1657,8 @@  exit_nfc_init:
 	release_resources(this);
 exit_acquire_resources:
 	platform_set_drvdata(pdev, NULL);
-	kfree(this);
 	dev_err(this->dev, "driver registration failed: %d\n", ret);
+	kfree(this);
 
 	return ret;
 }