aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmol Lad <amol@verismonetworks.com>2006-12-08 05:40:02 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:29:04 -0500
commitef26dd7ffa305382aabcd95fd574d01808a65c41 (patch)
tree1ef1fc0938d8d8e1225a219634e64fa3cd86aed6
parentdd607d23ff4cc004da2986d0b264a972c6a2da3e (diff)
[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 <amol@verismonetworks.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/virgefb.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/video/virgefb.c b/drivers/video/virgefb.c
index 64378959dd7b..b9fb6fb3600d 100644
--- a/drivers/video/virgefb.c
+++ b/drivers/video/virgefb.c
@@ -1799,7 +1799,7 @@ int __init virgefb_init(void)
1799 #warning release resources 1799 #warning release resources
1800 printk(KERN_ERR "virgefb.c: register_framebuffer failed\n"); 1800 printk(KERN_ERR "virgefb.c: register_framebuffer failed\n");
1801 DPRINTK("EXIT\n"); 1801 DPRINTK("EXIT\n");
1802 return -EINVAL; 1802 goto out_unmap;
1803 } 1803 }
1804 1804
1805 printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n", 1805 printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n",
@@ -1809,6 +1809,21 @@ int __init virgefb_init(void)
1809 1809
1810 DPRINTK("EXIT\n"); 1810 DPRINTK("EXIT\n");
1811 return 0; 1811 return 0;
1812
1813out_unmap:
1814 if (board_addr >= 0x01000000) {
1815 if (v_ram)
1816 iounmap((void*)v_ram);
1817 if (vgaio_regs)
1818 iounmap(vgaio_regs);
1819 if (mmio_regs)
1820 iounmap(mmio_regs);
1821 if (vcode_switch_base)
1822 iounmap((void*)vcode_switch_base);
1823 v_ram = vcode_switch_base = 0;
1824 vgaio_regs = mmio_regs = NULL;
1825 }
1826 return -EINVAL;
1812} 1827}
1813 1828
1814 1829