arm: plat-omap: iommu: fix request_mem_region() error path
Subsystems (2)
PATCH 1/1 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.
--- arch/arm/plat-omap/iommu.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
arch/arm/plat-omap/iommu.c +8 -6
@@ -957,11 +957,6 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) err = -ENODEV ; goto err_mem; } - obj->regbase =ioremap (res->start,resource_size (res)); -if (!obj->regbase) { - err = -ENOMEM ; - goto err_mem; - } res =request_mem_region (res->start,resource_size (res),dev_name (&pdev->dev));
@@ -970,6 +965,12 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) goto err_mem; } + obj->regbase =ioremap (res->start,resource_size (res)); +if (!obj->regbase) { + err = -ENOMEM ; + goto err_ioremap; + } + irq =platform_get_irq (pdev,0 );if (irq <0 ) { err = -ENODEV ;
@@ -998,8 +999,9 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev) err_pgd:free_irq (irq, obj); err_irq: -release_mem_region (res->start,resource_size (res));iounmap (obj->regbase); +err_ioremap: +release_mem_region (res->start,resource_size (res)); err_mem:clk_put (obj->clk); err_clk:
Signature · 1 line
1.5.6.5
PATCH 1/1 arm: plat-omap: iommu: fix request_mem_region() error path
Hi Aaro,
From: Aaro Koskinen <[email protected]>
Subject: [PATCH] arm: plat-omap: iommu: fix request_mem_region() error path
Date: Mon, 14 Mar 2011 14:28:32 +0200
Quoted 8 lines
request_mem_region()error exit will leak ioremapped memory. Fix this by moving theioremap()afterrequest_mem_region(), which is the proper order to do this anyway.Signed-off-by Aaro Koskinen <[email protected]>--- arch/arm/plat-omap/iommu.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
True. Thank you for catching this.
PATCH 1/1 arm: plat-omap: iommu: fix request_mem_region() error path
Quoted 10 lines · Hiroshi DOYU
Hi Aaro,
From: Aaro Koskinen <[email protected]>
Subject: [PATCH] arm: plat-omap: iommu: fixrequest_mem_region()error path
Date: Mon, 14 Mar 2011 14:28:32 +0200Quoted 4 lines
request_mem_region()error exit will leak ioremapped memory. Fix this by moving theioremap()afterrequest_mem_region(), which is the proper order to do this anyway.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Aaro Koskinen <[email protected]>--- arch/arm/plat-omap/iommu.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)True. Thank you for catching this.
Applying.
Tony