aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/qe_lib/ucc_slow.c
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2008-08-20 10:29:09 -0500
committerKumar Gala <galak@kernel.crashing.org>2008-08-20 23:58:12 -0500
commit61a4e9e91dd3916ef91aa4899b7271bba0248677 (patch)
treef5efdda2417abec232276f011c4fb422959994e6 /arch/powerpc/sysdev/qe_lib/ucc_slow.c
parentpowerpc/85xx: TQM8548: DTS file fixes and cleanup (diff)
downloadlinux-dev-61a4e9e91dd3916ef91aa4899b7271bba0248677.tar.xz
linux-dev-61a4e9e91dd3916ef91aa4899b7271bba0248677.zip
powerpc: fix memory leaks in QE library
Fix two memory leaks in the Freescale QE library: add a missing kfree() in ucc_fast_init() and ucc_slow_init() if the ioremap() fails, and update ucc_fast_free() and ucc_slow_free() to call iounmap() if necessary. Based on a patch from Tony Breeds <tony@bakeyournoodle.com>. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/qe_lib/ucc_slow.c')
-rw-r--r--arch/powerpc/sysdev/qe_lib/ucc_slow.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
index a578bc77b9d5..e1d6a1340157 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c
@@ -171,6 +171,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc
uccs->us_regs = ioremap(us_info->regs, sizeof(struct ucc_slow));
if (uccs->us_regs == NULL) {
printk(KERN_ERR "%s: Cannot map UCC registers\n", __func__);
+ kfree(uccs);
return -ENOMEM;
}
@@ -367,10 +368,11 @@ void ucc_slow_free(struct ucc_slow_private * uccs)
if (uccs->tx_base_offset)
qe_muram_free(uccs->tx_base_offset);
- if (uccs->us_pram) {
+ if (uccs->us_pram)
qe_muram_free(uccs->us_pram_offset);
- uccs->us_pram = NULL;
- }
+
+ if (uccs->us_regs)
+ iounmap(uccs->us_regs);
kfree(uccs);
}