aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tridentfb.c
diff options
context:
space:
mode:
authorAmol Lad <amol@verismonetworks.com>2006-12-08 05:40:03 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:29:04 -0500
commita02f6402d5a18f5a4fd35cb82887c1097d0f7792 (patch)
tree43046222e74b789358190b9edca1990fc053a871 /drivers/video/tridentfb.c
parentb88a57cc645c59a3652f391f8069b15d42ac0762 (diff)
[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: Amol Lad <amol@verismonetworks.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Knut Petersen <Knut_Petersen@t-online.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/tridentfb.c')
-rw-r--r--drivers/video/tridentfb.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c
index 14175cdb9c9c..55e8aa450bfa 100644
--- a/drivers/video/tridentfb.c
+++ b/drivers/video/tridentfb.c
@@ -1130,7 +1130,8 @@ static int __devinit trident_pci_probe(struct pci_dev * dev, const struct pci_de
1130 1130
1131 if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) { 1131 if (!request_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len, "tridentfb")) {
1132 debug("request_mem_region failed!\n"); 1132 debug("request_mem_region failed!\n");
1133 return -1; 1133 err = -1;
1134 goto out_unmap;
1134 } 1135 }
1135 1136
1136 fb_info.screen_base = ioremap_nocache(tridentfb_fix.smem_start, 1137 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 if (!fb_info.screen_base) { 1140 if (!fb_info.screen_base) {
1140 release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len); 1141 release_mem_region(tridentfb_fix.smem_start, tridentfb_fix.smem_len);
1141 debug("ioremap failed\n"); 1142 debug("ioremap failed\n");
1142 return -1; 1143 err = -1;
1144 goto out_unmap;
1143 } 1145 }
1144 1146
1145 output("%s board found\n", pci_name(dev)); 1147 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#endif 1164#endif
1163 fb_info.pseudo_palette = pseudo_pal; 1165 fb_info.pseudo_palette = pseudo_pal;
1164 1166
1165 if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp)) 1167 if (!fb_find_mode(&default_var,&fb_info,mode,NULL,0,NULL,bpp)) {
1166 return -EINVAL; 1168 err = -EINVAL;
1169 goto out_unmap;
1170 }
1167 fb_alloc_cmap(&fb_info.cmap,256,0); 1171 fb_alloc_cmap(&fb_info.cmap,256,0);
1168 if (defaultaccel && acc) 1172 if (defaultaccel && acc)
1169 default_var.accel_flags |= FB_ACCELF_TEXT; 1173 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 fb_info.device = &dev->dev; 1178 fb_info.device = &dev->dev;
1175 if (register_framebuffer(&fb_info) < 0) { 1179 if (register_framebuffer(&fb_info) < 0) {
1176 printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n"); 1180 printk(KERN_ERR "tridentfb: could not register Trident framebuffer\n");
1177 return -EINVAL; 1181 err = -EINVAL;
1182 goto out_unmap;
1178 } 1183 }
1179 output("fb%d: %s frame buffer device %dx%d-%dbpp\n", 1184 output("fb%d: %s frame buffer device %dx%d-%dbpp\n",
1180 fb_info.node, fb_info.fix.id,default_var.xres, 1185 fb_info.node, fb_info.fix.id,default_var.xres,
1181 default_var.yres,default_var.bits_per_pixel); 1186 default_var.yres,default_var.bits_per_pixel);
1182 return 0; 1187 return 0;
1188
1189out_unmap:
1190 if (default_par.io_virt)
1191 iounmap(default_par.io_virt);
1192 if (fb_info.screen_base)
1193 iounmap(fb_info.screen_base);
1194 return err;
1183} 1195}
1184 1196
1185static void __devexit trident_pci_remove(struct pci_dev * dev) 1197static void __devexit trident_pci_remove(struct pci_dev * dev)