From patchwork Mon Mar 14 12:28:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Koskinen, Aaro (Nokia - FI/Espoo)" X-Patchwork-Id: 632931 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2ECOUZC000902 for ; Mon, 14 Mar 2011 12:24:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755366Ab1CNMYa (ORCPT ); Mon, 14 Mar 2011 08:24:30 -0400 Received: from smtp.nokia.com ([147.243.128.26]:63611 "EHLO mgw-da02.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754227Ab1CNMY3 (ORCPT ); Mon, 14 Mar 2011 08:24:29 -0400 Received: from nokia.com (localhost [127.0.0.1]) by mgw-da02.nokia.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id p2ECOOBW015028; Mon, 14 Mar 2011 14:24:24 +0200 Received: from localhost.localdomain ([corebot.research.nokia.com [172.21.34.37]]) by mgw-da02.nokia.com with RELAY id p2ECODJO014838 ; Mon, 14 Mar 2011 14:24:16 +0200 From: Aaro Koskinen To: tony@atomide.com, Hiroshi.DOYU@nokia.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Aaro Koskinen Subject: [PATCH] arm: plat-omap: iommu: fix request_mem_region() error path Date: Mon, 14 Mar 2011 14:28:32 +0200 Message-Id: <1300105712-12656-1-git-send-email-aaro.koskinen@nokia.com> X-Mailer: git-send-email 1.5.6.5 X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 14 Mar 2011 12:24:31 +0000 (UTC) diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c index b1107c0..50be5e7 100644 --- a/arch/arm/plat-omap/iommu.c +++ b/arch/arm/plat-omap/iommu.c @@ -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: