From: Amol Lad Date: Fri, 8 Dec 2006 10:40:02 +0000 (-0800) Subject: [PATCH] ioremap balanced with iounmap for drivers/video/virgefb X-Git-Tag: v2.6.20-rc1~34^2~115 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef26dd7ffa305382aabcd95fd574d01808a65c41;p=linux-2.6 [PATCH] ioremap balanced with iounmap for drivers/video/virgefb ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Signed-off-by: Amol Lad Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/video/virgefb.c b/drivers/video/virgefb.c index 64378959dd..b9fb6fb360 100644 --- a/drivers/video/virgefb.c +++ b/drivers/video/virgefb.c @@ -1799,7 +1799,7 @@ int __init virgefb_init(void) #warning release resources printk(KERN_ERR "virgefb.c: register_framebuffer failed\n"); DPRINTK("EXIT\n"); - return -EINVAL; + goto out_unmap; } printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n", @@ -1809,6 +1809,21 @@ int __init virgefb_init(void) DPRINTK("EXIT\n"); return 0; + +out_unmap: + if (board_addr >= 0x01000000) { + if (v_ram) + iounmap((void*)v_ram); + if (vgaio_regs) + iounmap(vgaio_regs); + if (mmio_regs) + iounmap(mmio_regs); + if (vcode_switch_base) + iounmap((void*)vcode_switch_base); + v_ram = vcode_switch_base = 0; + vgaio_regs = mmio_regs = NULL; + } + return -EINVAL; }