diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-12-24 03:33:43 -0500 |
---|---|---|
committer | Inki Dae <inki.dae@samsung.com> | 2013-01-04 01:54:34 -0500 |
commit | 87acdde56d4cbf9c4b6a4d278434333bd613fd16 (patch) | |
tree | c548f06bdc4dad3d1b267ae56792f231bcef8d66 /drivers/gpu | |
parent | bfb6ed26008b47c5b2b4df073a45627f31f12966 (diff) |
drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_fimc.c
devm_* APIs are device managed and get freed automatically when the
device detaches. Thus explicit freeing is not needed. This saves some
code.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimc.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 2c03ffa817e8..ad0e4abc2b29 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
@@ -1741,64 +1741,58 @@ static int __devinit fimc_probe(struct platform_device *pdev) | |||
1741 | ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); | 1741 | ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); |
1742 | if (IS_ERR(ctx->sclk_fimc_clk)) { | 1742 | if (IS_ERR(ctx->sclk_fimc_clk)) { |
1743 | dev_err(dev, "failed to get src fimc clock.\n"); | 1743 | dev_err(dev, "failed to get src fimc clock.\n"); |
1744 | ret = PTR_ERR(ctx->sclk_fimc_clk); | 1744 | return PTR_ERR(ctx->sclk_fimc_clk); |
1745 | goto err_ctx; | ||
1746 | } | 1745 | } |
1747 | clk_enable(ctx->sclk_fimc_clk); | 1746 | clk_enable(ctx->sclk_fimc_clk); |
1748 | 1747 | ||
1749 | ctx->fimc_clk = clk_get(dev, "fimc"); | 1748 | ctx->fimc_clk = clk_get(dev, "fimc"); |
1750 | if (IS_ERR(ctx->fimc_clk)) { | 1749 | if (IS_ERR(ctx->fimc_clk)) { |
1751 | dev_err(dev, "failed to get fimc clock.\n"); | 1750 | dev_err(dev, "failed to get fimc clock.\n"); |
1752 | ret = PTR_ERR(ctx->fimc_clk); | ||
1753 | clk_disable(ctx->sclk_fimc_clk); | 1751 | clk_disable(ctx->sclk_fimc_clk); |
1754 | clk_put(ctx->sclk_fimc_clk); | 1752 | clk_put(ctx->sclk_fimc_clk); |
1755 | goto err_ctx; | 1753 | return PTR_ERR(ctx->fimc_clk); |
1756 | } | 1754 | } |
1757 | 1755 | ||
1758 | ctx->wb_clk = clk_get(dev, "pxl_async0"); | 1756 | ctx->wb_clk = clk_get(dev, "pxl_async0"); |
1759 | if (IS_ERR(ctx->wb_clk)) { | 1757 | if (IS_ERR(ctx->wb_clk)) { |
1760 | dev_err(dev, "failed to get writeback a clock.\n"); | 1758 | dev_err(dev, "failed to get writeback a clock.\n"); |
1761 | ret = PTR_ERR(ctx->wb_clk); | ||
1762 | clk_disable(ctx->sclk_fimc_clk); | 1759 | clk_disable(ctx->sclk_fimc_clk); |
1763 | clk_put(ctx->sclk_fimc_clk); | 1760 | clk_put(ctx->sclk_fimc_clk); |
1764 | clk_put(ctx->fimc_clk); | 1761 | clk_put(ctx->fimc_clk); |
1765 | goto err_ctx; | 1762 | return PTR_ERR(ctx->wb_clk); |
1766 | } | 1763 | } |
1767 | 1764 | ||
1768 | ctx->wb_b_clk = clk_get(dev, "pxl_async1"); | 1765 | ctx->wb_b_clk = clk_get(dev, "pxl_async1"); |
1769 | if (IS_ERR(ctx->wb_b_clk)) { | 1766 | if (IS_ERR(ctx->wb_b_clk)) { |
1770 | dev_err(dev, "failed to get writeback b clock.\n"); | 1767 | dev_err(dev, "failed to get writeback b clock.\n"); |
1771 | ret = PTR_ERR(ctx->wb_b_clk); | ||
1772 | clk_disable(ctx->sclk_fimc_clk); | 1768 | clk_disable(ctx->sclk_fimc_clk); |
1773 | clk_put(ctx->sclk_fimc_clk); | 1769 | clk_put(ctx->sclk_fimc_clk); |
1774 | clk_put(ctx->fimc_clk); | 1770 | clk_put(ctx->fimc_clk); |
1775 | clk_put(ctx->wb_clk); | 1771 | clk_put(ctx->wb_clk); |
1776 | goto err_ctx; | 1772 | return PTR_ERR(ctx->wb_b_clk); |
1777 | } | 1773 | } |
1778 | 1774 | ||
1779 | parent_clk = clk_get(dev, ddata->parent_clk); | 1775 | parent_clk = clk_get(dev, ddata->parent_clk); |
1780 | 1776 | ||
1781 | if (IS_ERR(parent_clk)) { | 1777 | if (IS_ERR(parent_clk)) { |
1782 | dev_err(dev, "failed to get parent clock.\n"); | 1778 | dev_err(dev, "failed to get parent clock.\n"); |
1783 | ret = PTR_ERR(parent_clk); | ||
1784 | clk_disable(ctx->sclk_fimc_clk); | 1779 | clk_disable(ctx->sclk_fimc_clk); |
1785 | clk_put(ctx->sclk_fimc_clk); | 1780 | clk_put(ctx->sclk_fimc_clk); |
1786 | clk_put(ctx->fimc_clk); | 1781 | clk_put(ctx->fimc_clk); |
1787 | clk_put(ctx->wb_clk); | 1782 | clk_put(ctx->wb_clk); |
1788 | clk_put(ctx->wb_b_clk); | 1783 | clk_put(ctx->wb_b_clk); |
1789 | goto err_ctx; | 1784 | return PTR_ERR(parent_clk); |
1790 | } | 1785 | } |
1791 | 1786 | ||
1792 | if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { | 1787 | if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { |
1793 | dev_err(dev, "failed to set parent.\n"); | 1788 | dev_err(dev, "failed to set parent.\n"); |
1794 | ret = -EINVAL; | ||
1795 | clk_put(parent_clk); | 1789 | clk_put(parent_clk); |
1796 | clk_disable(ctx->sclk_fimc_clk); | 1790 | clk_disable(ctx->sclk_fimc_clk); |
1797 | clk_put(ctx->sclk_fimc_clk); | 1791 | clk_put(ctx->sclk_fimc_clk); |
1798 | clk_put(ctx->fimc_clk); | 1792 | clk_put(ctx->fimc_clk); |
1799 | clk_put(ctx->wb_clk); | 1793 | clk_put(ctx->wb_clk); |
1800 | clk_put(ctx->wb_b_clk); | 1794 | clk_put(ctx->wb_b_clk); |
1801 | goto err_ctx; | 1795 | return -EINVAL; |
1802 | } | 1796 | } |
1803 | 1797 | ||
1804 | clk_put(parent_clk); | 1798 | clk_put(parent_clk); |
@@ -1824,7 +1818,7 @@ static int __devinit fimc_probe(struct platform_device *pdev) | |||
1824 | if (!res) { | 1818 | if (!res) { |
1825 | dev_err(dev, "failed to request irq resource.\n"); | 1819 | dev_err(dev, "failed to request irq resource.\n"); |
1826 | ret = -ENOENT; | 1820 | ret = -ENOENT; |
1827 | goto err_get_regs; | 1821 | goto err_clk; |
1828 | } | 1822 | } |
1829 | 1823 | ||
1830 | ctx->irq = res->start; | 1824 | ctx->irq = res->start; |
@@ -1832,7 +1826,7 @@ static int __devinit fimc_probe(struct platform_device *pdev) | |||
1832 | IRQF_ONESHOT, "drm_fimc", ctx); | 1826 | IRQF_ONESHOT, "drm_fimc", ctx); |
1833 | if (ret < 0) { | 1827 | if (ret < 0) { |
1834 | dev_err(dev, "failed to request irq.\n"); | 1828 | dev_err(dev, "failed to request irq.\n"); |
1835 | goto err_get_regs; | 1829 | goto err_clk; |
1836 | } | 1830 | } |
1837 | 1831 | ||
1838 | /* context initailization */ | 1832 | /* context initailization */ |
@@ -1878,15 +1872,12 @@ err_ippdrv_register: | |||
1878 | pm_runtime_disable(dev); | 1872 | pm_runtime_disable(dev); |
1879 | err_get_irq: | 1873 | err_get_irq: |
1880 | free_irq(ctx->irq, ctx); | 1874 | free_irq(ctx->irq, ctx); |
1881 | err_get_regs: | ||
1882 | devm_iounmap(dev, ctx->regs); | ||
1883 | err_clk: | 1875 | err_clk: |
1884 | clk_put(ctx->sclk_fimc_clk); | 1876 | clk_put(ctx->sclk_fimc_clk); |
1885 | clk_put(ctx->fimc_clk); | 1877 | clk_put(ctx->fimc_clk); |
1886 | clk_put(ctx->wb_clk); | 1878 | clk_put(ctx->wb_clk); |
1887 | clk_put(ctx->wb_b_clk); | 1879 | clk_put(ctx->wb_b_clk); |
1888 | err_ctx: | 1880 | |
1889 | devm_kfree(dev, ctx); | ||
1890 | return ret; | 1881 | return ret; |
1891 | } | 1882 | } |
1892 | 1883 | ||
@@ -1904,15 +1895,12 @@ static int __devexit fimc_remove(struct platform_device *pdev) | |||
1904 | pm_runtime_disable(dev); | 1895 | pm_runtime_disable(dev); |
1905 | 1896 | ||
1906 | free_irq(ctx->irq, ctx); | 1897 | free_irq(ctx->irq, ctx); |
1907 | devm_iounmap(dev, ctx->regs); | ||
1908 | 1898 | ||
1909 | clk_put(ctx->sclk_fimc_clk); | 1899 | clk_put(ctx->sclk_fimc_clk); |
1910 | clk_put(ctx->fimc_clk); | 1900 | clk_put(ctx->fimc_clk); |
1911 | clk_put(ctx->wb_clk); | 1901 | clk_put(ctx->wb_clk); |
1912 | clk_put(ctx->wb_b_clk); | 1902 | clk_put(ctx->wb_b_clk); |
1913 | 1903 | ||
1914 | devm_kfree(dev, ctx); | ||
1915 | |||
1916 | return 0; | 1904 | return 0; |
1917 | } | 1905 | } |
1918 | 1906 | ||