aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-08-29 05:52:42 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 18:40:22 -0400
commitcf363518ca44d654c51497b3f73c69a34565155d (patch)
tree692db693c4c2d7eb80815af3dd30a10e23669209
parent9d8b10437441e7f31ce86202ccadad922a9e914f (diff)
mtd: mpc5121_nfc: fix memory leak on error path
Add a call to of_node_put in the error handling code following a call to of_find_compatible_node. Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index df0c1da4ff49..f4610bc7ccd0 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -568,6 +568,7 @@ static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd)
568 uint rcw_width; 568 uint rcw_width;
569 uint rcwh; 569 uint rcwh;
570 uint romloc, ps; 570 uint romloc, ps;
571 int ret = 0;
571 572
572 rmnode = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset"); 573 rmnode = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset");
573 if (!rmnode) { 574 if (!rmnode) {
@@ -579,7 +580,8 @@ static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd)
579 rm = of_iomap(rmnode, 0); 580 rm = of_iomap(rmnode, 0);
580 if (!rm) { 581 if (!rm) {
581 dev_err(prv->dev, "Error mapping reset module node!\n"); 582 dev_err(prv->dev, "Error mapping reset module node!\n");
582 return -EBUSY; 583 ret = -EBUSY;
584 goto out;
583 } 585 }
584 586
585 rcwh = in_be32(&rm->rcwhr); 587 rcwh = in_be32(&rm->rcwhr);
@@ -628,8 +630,9 @@ static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd)
628 rcw_width * 8, rcw_pagesize, 630 rcw_width * 8, rcw_pagesize,
629 rcw_sparesize); 631 rcw_sparesize);
630 iounmap(rm); 632 iounmap(rm);
633out:
631 of_node_put(rmnode); 634 of_node_put(rmnode);
632 return 0; 635 return ret;
633} 636}
634 637
635/* Free driver resources */ 638/* Free driver resources */