aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJaya Kumar <jayakumar.arm@gmail.com>2008-06-21 23:27:26 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-06-22 09:31:31 -0400
commitee98476bbc565f8fe42e198602e647288b6a258d (patch)
treed767b67998ca20654065034b19622d3569a2f9ee /drivers/video
parentf1edfc420ac7beb90b27bf822036cbbfa32483f1 (diff)
[ARM] 5116/1: pxafb: cleanup and fix order of failure handling
This issue was found by Krzysztof Helt and Eric Miao. pxafb had issues in the order with which it cleaned up if errors occurred during a probe. This patch reorders the failure handling sequence and also frees the cmap and clk. Signed-off-by: Jaya Kumar <jayakumar.lkml@gmail.com> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Acked-by: Eric Miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/pxafb.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index eb23d1923332..796e0d1d5b19 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1685,14 +1685,14 @@ static int __init pxafb_probe(struct platform_device *dev)
1685 if (r == NULL) { 1685 if (r == NULL) {
1686 dev_err(&dev->dev, "no I/O memory resource defined\n"); 1686 dev_err(&dev->dev, "no I/O memory resource defined\n");
1687 ret = -ENODEV; 1687 ret = -ENODEV;
1688 goto failed; 1688 goto failed_fbi;
1689 } 1689 }
1690 1690
1691 r = request_mem_region(r->start, r->end - r->start + 1, dev->name); 1691 r = request_mem_region(r->start, r->end - r->start + 1, dev->name);
1692 if (r == NULL) { 1692 if (r == NULL) {
1693 dev_err(&dev->dev, "failed to request I/O memory\n"); 1693 dev_err(&dev->dev, "failed to request I/O memory\n");
1694 ret = -EBUSY; 1694 ret = -EBUSY;
1695 goto failed; 1695 goto failed_fbi;
1696 } 1696 }
1697 1697
1698 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); 1698 fbi->mmio_base = ioremap(r->start, r->end - r->start + 1);
@@ -1735,8 +1735,17 @@ static int __init pxafb_probe(struct platform_device *dev)
1735 * This makes sure that our colour bitfield 1735 * This makes sure that our colour bitfield
1736 * descriptors are correctly initialised. 1736 * descriptors are correctly initialised.
1737 */ 1737 */
1738 pxafb_check_var(&fbi->fb.var, &fbi->fb); 1738 ret = pxafb_check_var(&fbi->fb.var, &fbi->fb);
1739 pxafb_set_par(&fbi->fb); 1739 if (ret) {
1740 dev_err(&dev->dev, "failed to get suitable mode\n");
1741 goto failed_free_irq;
1742 }
1743
1744 ret = pxafb_set_par(&fbi->fb);
1745 if (ret) {
1746 dev_err(&dev->dev, "Failed to set parameters\n");
1747 goto failed_free_irq;
1748 }
1740 1749
1741 platform_set_drvdata(dev, fbi); 1750 platform_set_drvdata(dev, fbi);
1742 1751
@@ -1744,7 +1753,7 @@ static int __init pxafb_probe(struct platform_device *dev)
1744 if (ret < 0) { 1753 if (ret < 0) {
1745 dev_err(&dev->dev, 1754 dev_err(&dev->dev,
1746 "Failed to register framebuffer device: %d\n", ret); 1755 "Failed to register framebuffer device: %d\n", ret);
1747 goto failed_free_irq; 1756 goto failed_free_cmap;
1748 } 1757 }
1749 1758
1750#ifdef CONFIG_CPU_FREQ 1759#ifdef CONFIG_CPU_FREQ
@@ -1763,18 +1772,23 @@ static int __init pxafb_probe(struct platform_device *dev)
1763 1772
1764 return 0; 1773 return 0;
1765 1774
1775failed_free_cmap:
1776 if (fbi->fb.cmap.len)
1777 fb_dealloc_cmap(&fbi->fb.cmap);
1766failed_free_irq: 1778failed_free_irq:
1767 free_irq(irq, fbi); 1779 free_irq(irq, fbi);
1768failed_free_res:
1769 release_mem_region(r->start, r->end - r->start + 1);
1770failed_free_io:
1771 iounmap(fbi->mmio_base);
1772failed_free_mem: 1780failed_free_mem:
1773 dma_free_writecombine(&dev->dev, fbi->map_size, 1781 dma_free_writecombine(&dev->dev, fbi->map_size,
1774 fbi->map_cpu, fbi->map_dma); 1782 fbi->map_cpu, fbi->map_dma);
1775failed: 1783failed_free_io:
1784 iounmap(fbi->mmio_base);
1785failed_free_res:
1786 release_mem_region(r->start, r->end - r->start + 1);
1787failed_fbi:
1788 clk_put(fbi->clk);
1776 platform_set_drvdata(dev, NULL); 1789 platform_set_drvdata(dev, NULL);
1777 kfree(fbi); 1790 kfree(fbi);
1791failed:
1778 return ret; 1792 return ret;
1779} 1793}
1780 1794