Commit a02f6402 authored by Amol Lad's avatar Amol Lad Committed by Linus Torvalds

[PATCH] ioremap balanced with iounmap for drivers/video/tridentfb

ioremap must be balanced by an iounmap and failing to do so can result in a
memory leak.
Signed-off-by: default avatarAmol Lad <amol@verismonetworks.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Knut Petersen <Knut_Petersen@t-online.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b88a57cc
...@@ -1130,7 +1130,8 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de ...@@ -1130,7 +1130,8 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de
if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) { if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) {
debug("request_mem_region failed!\n"); debug("request_mem_region failed!\n");
return -1; err = -1;
goto out_unmap;
} }
fb_info.screen_base = ioremap_nocache(tridentfb_fix.smem_start, fb_info.screen_base = ioremap_nocache(tridentfb_fix.smem_start,
...@@ -1139,7 +1140,8 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de ...@@ -1139,7 +1140,8 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de
if (!fb_info.screen_base) { if (!fb_info.screen_base) {
release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len); release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
debug("ioremap failed\n"); debug("ioremap failed\n");
return -1; err = -1;
goto out_unmap;
} }
output("%s board found\n", pci_name(dev)); output("%s board found\n", pci_name(dev));
...@@ -1162,8 +1164,10 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de ...@@ -1162,8 +1164,10 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de
#endif #endif
fb_info.pseudo_palette = pseudo_pal; fb_info.pseudo_palette = pseudo_pal;
if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp)) if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp)) {
return -EINVAL; err = -EINVAL;
goto out_unmap;
}
fb_alloc_cmap(&fb_info.cmap,256,0); fb_alloc_cmap(&fb_info.cmap,256,0);
if (defaultaccel && acc) if (defaultaccel && acc)
default_var.accel_flags |= FB_ACCELF_TEXT; default_var.accel_flags |= FB_ACCELF_TEXT;
...@@ -1174,12 +1178,20 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de ...@@ -1174,12 +1178,20 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de
fb_info.device = &dev->dev; fb_info.device = &dev->dev;
if (register_framebuffer(&fb_info) < 0) { if (register_framebuffer(&fb_info) < 0) {
printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n"); printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n");
return -EINVAL; err = -EINVAL;
goto out_unmap;
} }
output("fb%d: %s frame buffer device %dx%d-%dbpp\n", output("fb%d: %s frame buffer device %dx%d-%dbpp\n",
fb_info.node, fb_info.fix.id,default_var.xres, fb_info.node, fb_info.fix.id,default_var.xres,
default_var.yres,default_var.bits_per_pixel); default_var.yres,default_var.bits_per_pixel);
return 0; return 0;
out_unmap:
if (default_par.io_virt)
iounmap(default_par.io_virt);
if (fb_info.screen_base)
iounmap(fb_info.screen_base);
return err;
} }
static void __devexit trident_pci_remove(struct pci_dev * dev) static void __devexit trident_pci_remove(struct pci_dev * dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment