From: Amol Lad Date: Sun, 1 Oct 2006 06:29:24 +0000 (-0700) Subject: [PATCH] ioremap balanced with iounmap for drivers/serial/mpsc.c X-Git-Tag: v2.6.19-rc1~508 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a141a04330bd6eadf7081a0860dc786be7d09c46;p=linux-2.6 [PATCH] ioremap balanced with iounmap for drivers/serial/mpsc.c ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Signed-off-by: Amol Lad Cc: Alan Cox Cc: Mark A. Greer Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 63d2a66e56..704243c9f7 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c @@ -1893,6 +1893,10 @@ mpsc_drv_map_regs(struct mpsc_port_info *pi, struct platform_device *pd) } else { mpsc_resource_err("SDMA base"); + if (pi->mpsc_base) { + iounmap(pi->mpsc_base); + pi->mpsc_base = NULL; + } return -ENOMEM; } @@ -1905,6 +1909,14 @@ mpsc_drv_map_regs(struct mpsc_port_info *pi, struct platform_device *pd) } else { mpsc_resource_err("BRG base"); + if (pi->mpsc_base) { + iounmap(pi->mpsc_base); + pi->mpsc_base = NULL; + } + if (pi->sdma_base) { + iounmap(pi->sdma_base); + pi->sdma_base = NULL; + } return -ENOMEM; }