diff options
Diffstat (limited to 'drivers/video/bf537-lq035.c')
-rw-r--r-- | drivers/video/bf537-lq035.c | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c index 18c507874ff1..47c21fb2c82f 100644 --- a/drivers/video/bf537-lq035.c +++ b/drivers/video/bf537-lq035.c | |||
@@ -696,6 +696,7 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
696 | { | 696 | { |
697 | struct backlight_properties props; | 697 | struct backlight_properties props; |
698 | dma_addr_t dma_handle; | 698 | dma_addr_t dma_handle; |
699 | int ret; | ||
699 | 700 | ||
700 | if (request_dma(CH_PPI, KBUILD_MODNAME)) { | 701 | if (request_dma(CH_PPI, KBUILD_MODNAME)) { |
701 | pr_err("couldn't request PPI DMA\n"); | 702 | pr_err("couldn't request PPI DMA\n"); |
@@ -704,17 +705,16 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
704 | 705 | ||
705 | if (request_ports()) { | 706 | if (request_ports()) { |
706 | pr_err("couldn't request gpio port\n"); | 707 | pr_err("couldn't request gpio port\n"); |
707 | free_dma(CH_PPI); | 708 | ret = -EFAULT; |
708 | return -EFAULT; | 709 | goto out_ports; |
709 | } | 710 | } |
710 | 711 | ||
711 | fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, | 712 | fb_buffer = dma_alloc_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, |
712 | &dma_handle, GFP_KERNEL); | 713 | &dma_handle, GFP_KERNEL); |
713 | if (fb_buffer == NULL) { | 714 | if (fb_buffer == NULL) { |
714 | pr_err("couldn't allocate dma buffer\n"); | 715 | pr_err("couldn't allocate dma buffer\n"); |
715 | free_dma(CH_PPI); | 716 | ret = -ENOMEM; |
716 | free_ports(); | 717 | goto out_dma_coherent; |
717 | return -ENOMEM; | ||
718 | } | 718 | } |
719 | 719 | ||
720 | if (L1_DATA_A_LENGTH) | 720 | if (L1_DATA_A_LENGTH) |
@@ -725,10 +725,8 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
725 | 725 | ||
726 | if (dma_desc_table == NULL) { | 726 | if (dma_desc_table == NULL) { |
727 | pr_err("couldn't allocate dma descriptor\n"); | 727 | pr_err("couldn't allocate dma descriptor\n"); |
728 | free_dma(CH_PPI); | 728 | ret = -ENOMEM; |
729 | free_ports(); | 729 | goto out_table; |
730 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
731 | return -ENOMEM; | ||
732 | } | 730 | } |
733 | 731 | ||
734 | bfin_lq035_fb.screen_base = (void *)fb_buffer; | 732 | bfin_lq035_fb.screen_base = (void *)fb_buffer; |
@@ -771,31 +769,21 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
771 | bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); | 769 | bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); |
772 | if (bfin_lq035_fb.pseudo_palette == NULL) { | 770 | if (bfin_lq035_fb.pseudo_palette == NULL) { |
773 | pr_err("failed to allocate pseudo_palette\n"); | 771 | pr_err("failed to allocate pseudo_palette\n"); |
774 | free_dma(CH_PPI); | 772 | ret = -ENOMEM; |
775 | free_ports(); | 773 | goto out_palette; |
776 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
777 | return -ENOMEM; | ||
778 | } | 774 | } |
779 | 775 | ||
780 | if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { | 776 | if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { |
781 | pr_err("failed to allocate colormap (%d entries)\n", | 777 | pr_err("failed to allocate colormap (%d entries)\n", |
782 | NBR_PALETTE); | 778 | NBR_PALETTE); |
783 | free_dma(CH_PPI); | 779 | ret = -EFAULT; |
784 | free_ports(); | 780 | goto out_cmap; |
785 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
786 | kfree(bfin_lq035_fb.pseudo_palette); | ||
787 | return -EFAULT; | ||
788 | } | 781 | } |
789 | 782 | ||
790 | if (register_framebuffer(&bfin_lq035_fb) < 0) { | 783 | if (register_framebuffer(&bfin_lq035_fb) < 0) { |
791 | pr_err("unable to register framebuffer\n"); | 784 | pr_err("unable to register framebuffer\n"); |
792 | free_dma(CH_PPI); | 785 | ret = -EINVAL; |
793 | free_ports(); | 786 | goto out_reg; |
794 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
795 | fb_buffer = NULL; | ||
796 | kfree(bfin_lq035_fb.pseudo_palette); | ||
797 | fb_dealloc_cmap(&bfin_lq035_fb.cmap); | ||
798 | return -EINVAL; | ||
799 | } | 787 | } |
800 | 788 | ||
801 | i2c_add_driver(&ad5280_driver); | 789 | i2c_add_driver(&ad5280_driver); |
@@ -807,11 +795,31 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev) | |||
807 | 795 | ||
808 | lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, | 796 | lcd_dev = lcd_device_register(KBUILD_MODNAME, &pdev->dev, NULL, |
809 | &bfin_lcd_ops); | 797 | &bfin_lcd_ops); |
798 | if (IS_ERR(lcd_dev)) { | ||
799 | pr_err("unable to register lcd\n"); | ||
800 | ret = PTR_ERR(lcd_dev); | ||
801 | goto out_lcd; | ||
802 | } | ||
810 | lcd_dev->props.max_contrast = 255, | 803 | lcd_dev->props.max_contrast = 255, |
811 | 804 | ||
812 | pr_info("initialized"); | 805 | pr_info("initialized"); |
813 | 806 | ||
814 | return 0; | 807 | return 0; |
808 | out_lcd: | ||
809 | unregister_framebuffer(&bfin_lq035_fb); | ||
810 | out_reg: | ||
811 | fb_dealloc_cmap(&bfin_lq035_fb.cmap); | ||
812 | out_cmap: | ||
813 | kfree(bfin_lq035_fb.pseudo_palette); | ||
814 | out_palette: | ||
815 | out_table: | ||
816 | dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); | ||
817 | fb_buffer = NULL; | ||
818 | out_dma_coherent: | ||
819 | free_ports(); | ||
820 | out_ports: | ||
821 | free_dma(CH_PPI); | ||
822 | return ret; | ||
815 | } | 823 | } |
816 | 824 | ||
817 | static int __devexit bfin_lq035_remove(struct platform_device *pdev) | 825 | static int __devexit bfin_lq035_remove(struct platform_device *pdev) |