linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [upstream] mtd/ifc: fix ifc driver memory release issue
@ 2013-03-27 12:25 Roy Zang
  2013-03-29  4:28 ` Brian Norris
  0 siblings, 1 reply; 3+ messages in thread
From: Roy Zang @ 2013-03-27 12:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: Li Hao, scottwood, linuxppc-dev, dwmw2, Cao Yonghua

memory is allocated by devm_kzalloc, so release it using
devm_kfree() instead kfree();

Signed-off-by: Li Hao <b44421@freescale.com>
Signed-off-by: Cao Yonghua <b43619@freescale.com>
Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
---
 drivers/mtd/nand/fsl_ifc_nand.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index f1f7f12..b574ca4 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -908,7 +908,7 @@ static int fsl_ifc_chip_remove(struct fsl_ifc_mtd *priv)
 
 	ifc_nand_ctrl->chips[priv->bank] = NULL;
 	dev_set_drvdata(priv->dev, NULL);
-	kfree(priv);
+	devm_kfree(priv->dev, priv);
 
 	return 0;
 }
@@ -974,6 +974,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
 		if (!ifc_nand_ctrl) {
 			dev_err(&dev->dev, "failed to allocate memory\n");
 			mutex_unlock(&fsl_ifc_nand_mutex);
+			devm_kfree(&dev->dev, priv);
 			return -ENOMEM;
 		}
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-10 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 12:25 [upstream] mtd/ifc: fix ifc driver memory release issue Roy Zang
2013-03-29  4:28 ` Brian Norris
2013-05-10 12:31   ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).