aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Cassou <damien.cassou@lifl.fr>2012-07-31 09:54:20 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-08-23 08:59:58 -0400
commite31f8745847c0086f909e04d4781804347c2377d (patch)
treea76fdfb41fdcc651fa9d7d4ad642685280fe8b2f
parentd1bea50288c7a22e68c01bb11cdb2a8db7d2fa39 (diff)
drivers/video/bf537-lq035.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Damien Cassou <damien.cassou@lifl.fr> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
-rw-r--r--drivers/video/bf537-lq035.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c
index befbc80d11f..7347aa1e5e4 100644
--- a/drivers/video/bf537-lq035.c
+++ b/drivers/video/bf537-lq035.c
@@ -760,18 +760,20 @@ static int __devinit bfin_lq035_probe(struct platform_device *pdev)
760 bfin_lq035_fb.flags = FBINFO_DEFAULT; 760 bfin_lq035_fb.flags = FBINFO_DEFAULT;
761 761
762 762
763 bfin_lq035_fb.pseudo_palette = kzalloc(sizeof(u32) * 16, GFP_KERNEL); 763 bfin_lq035_fb.pseudo_palette = devm_kzalloc(&pdev->dev,
764 sizeof(u32) * 16,
765 GFP_KERNEL);
764 if (bfin_lq035_fb.pseudo_palette == NULL) { 766 if (bfin_lq035_fb.pseudo_palette == NULL) {
765 pr_err("failed to allocate pseudo_palette\n"); 767 pr_err("failed to allocate pseudo_palette\n");
766 ret = -ENOMEM; 768 ret = -ENOMEM;
767 goto out_palette; 769 goto out_table;
768 } 770 }
769 771
770 if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) { 772 if (fb_alloc_cmap(&bfin_lq035_fb.cmap, NBR_PALETTE, 0) < 0) {
771 pr_err("failed to allocate colormap (%d entries)\n", 773 pr_err("failed to allocate colormap (%d entries)\n",
772 NBR_PALETTE); 774 NBR_PALETTE);
773 ret = -EFAULT; 775 ret = -EFAULT;
774 goto out_cmap; 776 goto out_table;
775 } 777 }
776 778
777 if (register_framebuffer(&bfin_lq035_fb) < 0) { 779 if (register_framebuffer(&bfin_lq035_fb) < 0) {
@@ -804,9 +806,6 @@ out_lcd:
804 unregister_framebuffer(&bfin_lq035_fb); 806 unregister_framebuffer(&bfin_lq035_fb);
805out_reg: 807out_reg:
806 fb_dealloc_cmap(&bfin_lq035_fb.cmap); 808 fb_dealloc_cmap(&bfin_lq035_fb.cmap);
807out_cmap:
808 kfree(bfin_lq035_fb.pseudo_palette);
809out_palette:
810out_table: 809out_table:
811 dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0); 810 dma_free_coherent(NULL, TOTAL_VIDEO_MEM_SIZE, fb_buffer, 0);
812 fb_buffer = NULL; 811 fb_buffer = NULL;
@@ -834,7 +833,6 @@ static int __devexit bfin_lq035_remove(struct platform_device *pdev)
834 free_dma(CH_PPI); 833 free_dma(CH_PPI);
835 834
836 835
837 kfree(bfin_lq035_fb.pseudo_palette);
838 fb_dealloc_cmap(&bfin_lq035_fb.cmap); 836 fb_dealloc_cmap(&bfin_lq035_fb.cmap);
839 837
840 838