diff options
author | Timur Tabi <timur@freescale.com> | 2008-08-20 10:29:09 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-08-20 23:58:12 -0500 |
commit | 61a4e9e91dd3916ef91aa4899b7271bba0248677 (patch) | |
tree | f5efdda2417abec232276f011c4fb422959994e6 /arch/powerpc/sysdev/qe_lib/ucc_fast.c | |
parent | d27a736c7a62c3451e389aa8e0dfc64dab119b9b (diff) |
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_fast.c')
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/ucc_fast.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c index 1aecb075a72..25fbbfaa837 100644 --- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c +++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c @@ -208,6 +208,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc uccf->uf_regs = ioremap(uf_info->regs, sizeof(struct ucc_fast)); if (uccf->uf_regs == NULL) { printk(KERN_ERR "%s: Cannot map UCC registers\n", __func__); + kfree(uccf); return -ENOMEM; } @@ -355,6 +356,9 @@ void ucc_fast_free(struct ucc_fast_private * uccf) if (uccf->ucc_fast_rx_virtual_fifo_base_offset) qe_muram_free(uccf->ucc_fast_rx_virtual_fifo_base_offset); + if (uccf->uf_regs) + iounmap(uccf->uf_regs); + kfree(uccf); } EXPORT_SYMBOL(ucc_fast_free); |