[upstream] mtd/ifc: fix ifc driver memory release issue
Roy Zang
tie-fei.zang at freescale.com
Wed Mar 27 23:25:00 EST 2013
memory is allocated by devm_kzalloc, so release it using
devm_kfree() instead kfree();
Signed-off-by: Li Hao <b44421 at freescale.com>
Signed-off-by: Cao Yonghua <b43619 at freescale.com>
Signed-off-by: Roy Zang <tie-fei.zang at 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
More information about the Linuxppc-dev
mailing list