diff options
Diffstat (limited to 'drivers/video/asiliantfb.c')
-rw-r--r-- | drivers/video/asiliantfb.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index 1fd22f460b0f..1a1f946d8fef 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -505,19 +505,27 @@ static struct fb_var_screeninfo asiliantfb_var __devinitdata = { | |||
505 | .vsync_len = 2, | 505 | .vsync_len = 2, |
506 | }; | 506 | }; |
507 | 507 | ||
508 | static void __devinit init_asiliant(struct fb_info *p, unsigned long addr) | 508 | static int __devinit init_asiliant(struct fb_info *p, unsigned long addr) |
509 | { | 509 | { |
510 | int err; | ||
511 | |||
510 | p->fix = asiliantfb_fix; | 512 | p->fix = asiliantfb_fix; |
511 | p->fix.smem_start = addr; | 513 | p->fix.smem_start = addr; |
512 | p->var = asiliantfb_var; | 514 | p->var = asiliantfb_var; |
513 | p->fbops = &asiliantfb_ops; | 515 | p->fbops = &asiliantfb_ops; |
514 | p->flags = FBINFO_DEFAULT; | 516 | p->flags = FBINFO_DEFAULT; |
515 | 517 | ||
516 | fb_alloc_cmap(&p->cmap, 256, 0); | 518 | err = fb_alloc_cmap(&p->cmap, 256, 0); |
519 | if (err) { | ||
520 | printk(KERN_ERR "C&T 69000 fb failed to alloc cmap memory\n"); | ||
521 | return err; | ||
522 | } | ||
517 | 523 | ||
518 | if (register_framebuffer(p) < 0) { | 524 | err = register_framebuffer(p); |
525 | if (err < 0) { | ||
519 | printk(KERN_ERR "C&T 69000 framebuffer failed to register\n"); | 526 | printk(KERN_ERR "C&T 69000 framebuffer failed to register\n"); |
520 | return; | 527 | fb_dealloc_cmap(&p->cmap); |
528 | return err; | ||
521 | } | 529 | } |
522 | 530 | ||
523 | printk(KERN_INFO "fb%d: Asiliant 69000 frame buffer (%dK RAM detected)\n", | 531 | printk(KERN_INFO "fb%d: Asiliant 69000 frame buffer (%dK RAM detected)\n", |
@@ -532,6 +540,7 @@ asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) | |||
532 | { | 540 | { |
533 | unsigned long addr, size; | 541 | unsigned long addr, size; |
534 | struct fb_info *p; | 542 | struct fb_info *p; |
543 | int err; | ||
535 | 544 | ||
536 | if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) | 545 | if ((dp->resource[0].flags & IORESOURCE_MEM) == 0) |
537 | return -ENODEV; | 546 | return -ENODEV; |
@@ -560,7 +569,13 @@ asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) | |||
560 | pci_write_config_dword(dp, 4, 0x02800083); | 569 | pci_write_config_dword(dp, 4, 0x02800083); |
561 | writeb(3, p->screen_base + 0x400784); | 570 | writeb(3, p->screen_base + 0x400784); |
562 | 571 | ||
563 | init_asiliant(p, addr); | 572 | err = init_asiliant(p, addr); |
573 | if (err) { | ||
574 | iounmap(p->screen_base); | ||
575 | release_mem_region(addr, size); | ||
576 | framebuffer_release(p); | ||
577 | return err; | ||
578 | } | ||
564 | 579 | ||
565 | pci_set_drvdata(dp, p); | 580 | pci_set_drvdata(dp, p); |
566 | return 0; | 581 | return 0; |
@@ -571,6 +586,7 @@ static void __devexit asiliantfb_remove(struct pci_dev *dp) | |||
571 | struct fb_info *p = pci_get_drvdata(dp); | 586 | struct fb_info *p = pci_get_drvdata(dp); |
572 | 587 | ||
573 | unregister_framebuffer(p); | 588 | unregister_framebuffer(p); |
589 | fb_dealloc_cmap(&p->cmap); | ||
574 | iounmap(p->screen_base); | 590 | iounmap(p->screen_base); |
575 | release_mem_region(pci_resource_start(dp, 0), pci_resource_len(dp, 0)); | 591 | release_mem_region(pci_resource_start(dp, 0), pci_resource_len(dp, 0)); |
576 | pci_set_drvdata(dp, NULL); | 592 | pci_set_drvdata(dp, NULL); |