Browse Source

igafb: use framebuffer_alloc() to allocate fb_info struct

Use the framebuffer_alloc() function to allocate the fb_info
structure so the structure is correctly initialized after allocation.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Krzysztof Helt 16 years ago
parent
commit
100b4a6eef
1 changed files with 3 additions and 5 deletions
  1. 3 5
      drivers/video/igafb.c

+ 3 - 5
drivers/video/igafb.c

@@ -395,17 +395,16 @@ int __init igafb_init(void)
 	/* We leak a reference here but as it cannot be unloaded this is
 	/* We leak a reference here but as it cannot be unloaded this is
 	   fine. If you write unload code remember to free it in unload */
 	   fine. If you write unload code remember to free it in unload */
 	
 	
-	size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16;
+	size = sizeof(struct iga_par) + sizeof(u32)*16;
 
 
-        info = kzalloc(size, GFP_ATOMIC);
+	info = framebuffer_alloc(size, &pdev->dev);
         if (!info) {
         if (!info) {
                 printk("igafb_init: can't alloc fb_info\n");
                 printk("igafb_init: can't alloc fb_info\n");
 		 pci_dev_put(pdev);
 		 pci_dev_put(pdev);
                 return -ENOMEM;
                 return -ENOMEM;
         }
         }
 
 
-	par = (struct iga_par *) (info + 1);
-	
+	par = info->par;
 
 
 	if ((addr = pdev->resource[0].start) == 0) {
 	if ((addr = pdev->resource[0].start) == 0) {
                 printk("igafb_init: no memory start\n");
                 printk("igafb_init: no memory start\n");
@@ -526,7 +525,6 @@ int __init igafb_init(void)
 	info->var = default_var;
 	info->var = default_var;
 	info->fix = igafb_fix;
 	info->fix = igafb_fix;
 	info->pseudo_palette = (void *)(par + 1);
 	info->pseudo_palette = (void *)(par + 1);
-	info->device = &pdev->dev;
 
 
 	if (!iga_init(info, par)) {
 	if (!iga_init(info, par)) {
 		iounmap((void *)par->io_base);
 		iounmap((void *)par->io_base);