diff options
author | Aaro Koskinen <Aaro.Koskinen@nokia.com> | 2011-03-14 08:28:32 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-03-14 14:14:34 -0400 |
commit | da4a0f764a6017659bf32505bbd773f561eaf605 (patch) | |
tree | eaa500c6cb4f137d0144ba036d213fb6a06a3fff /arch/arm/plat-omap/iommu.c | |
parent | b235e007831dbf57710e59cd4a120e2f374eecb9 (diff) |
arm: plat-omap: iommu: fix request_mem_region() error path
request_mem_region() error exit will leak ioremapped memory. Fix this
by moving the ioremap() after request_mem_region(), which is the proper
order to do this anyway.
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/iommu.c')
-rw-r--r-- | arch/arm/plat-omap/iommu.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index e3eb0380090a..8a51fd58f656 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c | |||
@@ -982,11 +982,6 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) | |||
982 | err = -ENODEV; | 982 | err = -ENODEV; |
983 | goto err_mem; | 983 | goto err_mem; |
984 | } | 984 | } |
985 | obj->regbase = ioremap(res->start, resource_size(res)); | ||
986 | if (!obj->regbase) { | ||
987 | err = -ENOMEM; | ||
988 | goto err_mem; | ||
989 | } | ||
990 | 985 | ||
991 | res = request_mem_region(res->start, resource_size(res), | 986 | res = request_mem_region(res->start, resource_size(res), |
992 | dev_name(&pdev->dev)); | 987 | dev_name(&pdev->dev)); |
@@ -995,6 +990,12 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) | |||
995 | goto err_mem; | 990 | goto err_mem; |
996 | } | 991 | } |
997 | 992 | ||
993 | obj->regbase = ioremap(res->start, resource_size(res)); | ||
994 | if (!obj->regbase) { | ||
995 | err = -ENOMEM; | ||
996 | goto err_ioremap; | ||
997 | } | ||
998 | |||
998 | irq = platform_get_irq(pdev, 0); | 999 | irq = platform_get_irq(pdev, 0); |
999 | if (irq < 0) { | 1000 | if (irq < 0) { |
1000 | err = -ENODEV; | 1001 | err = -ENODEV; |
@@ -1023,8 +1024,9 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) | |||
1023 | err_pgd: | 1024 | err_pgd: |
1024 | free_irq(irq, obj); | 1025 | free_irq(irq, obj); |
1025 | err_irq: | 1026 | err_irq: |
1026 | release_mem_region(res->start, resource_size(res)); | ||
1027 | iounmap(obj->regbase); | 1027 | iounmap(obj->regbase); |
1028 | err_ioremap: | ||
1029 | release_mem_region(res->start, resource_size(res)); | ||
1028 | err_mem: | 1030 | err_mem: |
1029 | clk_put(obj->clk); | 1031 | clk_put(obj->clk); |
1030 | err_clk: | 1032 | err_clk: |