From patchwork Mon Sep 17 18:16:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 11464 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id EDEE123F9E for ; Mon, 17 Sep 2012 17:56:45 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 81C5EA18E3A for ; Mon, 17 Sep 2012 17:56:45 +0000 (UTC) Received: by iafj25 with SMTP id j25so5280639iaf.11 for ; Mon, 17 Sep 2012 10:56:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-gm-message-state; bh=Hb9zI6ERmthJzJPSF8Yd+mupH92+fmqZ1jAOyA4TrMo=; b=Dnx9jD8OE1SfShe8SiD1gn3RS+qHVvXLYAfTTT2N8q7xlyTi7u4iMYvIdCJ8x+S2uN tthW5Z1bUTld3yEBvj/kvBMLzzU/lvDqIoXnZRLg6PGFuxDT7Q0HKlcqZMkVjXXP0D5U 7h4KYqyRswlBXZ1EIRFVC/2oPBDrVmGKnphwcn8z6/XgCUb95NE1xbayfYTu5yUjeZg6 ABrjKPgT4pvGAdi9SqMhAcyGaTSweeWebN6bY4o+jAuNBhS5aMC2PejhEqyHSFDNXm5G 4/NGxeCkftcgRbL4539J3Z0zXzbtmKtT9/HI7A+pIENk60UqG7nXUmlvwZjJhOVzVy3v oPZw== Received: by 10.50.242.3 with SMTP id wm3mr7843976igc.0.1347904604845; Mon, 17 Sep 2012 10:56:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp329887igc; Mon, 17 Sep 2012 10:56:44 -0700 (PDT) Received: by 10.68.232.194 with SMTP id tq2mr23616467pbc.111.1347904604116; Mon, 17 Sep 2012 10:56:44 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id te6si16521390pbc.44.2012.09.17.10.56.43; Mon, 17 Sep 2012 10:56:44 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MAI00EXM9U9AKY0@mailout2.samsung.com>; Tue, 18 Sep 2012 02:56:42 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-12-5057645a58af Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 87.08.03783.A5467505; Tue, 18 Sep 2012 02:56:42 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MAI00MTJ9U8PO50@mmp1.samsung.com>; Tue, 18 Sep 2012 02:56:42 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: will.newton@imgtec.com, cjb@laptop.org, grant.likely@secretlab.ca, rob.herring@calxeda.com, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, girish.shivananjappa@linaro.org, jh80.chung@samsung.com, tgih.jun@samsung.com, patches@linaro.org Subject: [PATCH v6 2/9] mmc: dw_mmc: Use devm_* functions in dw_mmc platform driver Date: Mon, 17 Sep 2012 23:46:36 +0530 Message-id: <1347905803-22742-3-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1347905803-22742-1-git-send-email-thomas.abraham@linaro.org> References: <1347905803-22742-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t9jAd2olPAAg6tPzS2+fD3BZjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlPHz+j7VgEl/FpEcL2RoYD3F3MXJySAiYSDz7f5kZ whaTuHBvPVsXIxeHkMAiRoljbe+gnDYmiQuzDrKBVLEJGEg8WviOHcQWEXCSWDJ3AjNIEbNA I5PExoU7wYqEBUIlVu49AmazCKhKvJjwnBHE5hXwlJh2sIcJYp2SxIbeo2A2p4CXxPTth8CG CgHV7F0xm2UCI+8CRoZVjKKpBckFxUnpuYZ6xYm5xaV56XrJ+bmbGMEB8ExqB+PKBotDjAIc jEo8vIEu4QFCrIllxZW5hxglOJiVRHhvCwCFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8wp/CgwQ EkhPLEnNTk0tSC2CyTJxcEo1MGZJrzH7OoHHmX+LbdeX+1NmXRM63zj98Zczuw/zGd6M5VD/ y3j7kNMDdpGrzyO698q98Hss/+rPf+YUfZUTYd+l7b5Z+KWE8f1Is3ij01axUjvV8US1cOrd d61fm5VmX1B3XPedy8NixRS9l9am69WSbny6snna7t4DwdOnq0r/+mNx98u9+W1KLMUZiYZa zEXFiQCfiK+m/AEAAA== X-Gm-Message-State: ALoCoQmp6cbIz5oQRPptopLxfp7DoXZ1VSERMq4VVI4x0HIElrh68QVBKv/hFmZTFaOBb32SXrcz Use devm_* managed functions for simpler error handling. Signed-off-by: Thomas Abraham Acked-by: Will Newton --- drivers/mmc/host/dw_mmc-pltfm.c | 29 ++++++++--------------------- 1 files changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c index 528d37b..ce7be1a 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -27,38 +27,27 @@ static int __devinit dw_mci_pltfm_probe(struct platform_device *pdev) struct resource *regs; int ret; - host = kzalloc(sizeof(struct dw_mci), GFP_KERNEL); + host = devm_kzalloc(&pdev->dev, sizeof(struct dw_mci), GFP_KERNEL); if (!host) return -ENOMEM; regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!regs) { - ret = -ENXIO; - goto err_free; - } + if (!regs) + return -ENXIO; host->irq = platform_get_irq(pdev, 0); - if (host->irq < 0) { - ret = host->irq; - goto err_free; - } + if (host->irq < 0) + return host->irq; host->dev = &pdev->dev; host->irq_flags = 0; host->pdata = pdev->dev.platform_data; - ret = -ENOMEM; - host->regs = ioremap(regs->start, resource_size(regs)); + host->regs = devm_request_and_ioremap(&pdev->dev, regs); if (!host->regs) - goto err_free; + return -ENOMEM; + platform_set_drvdata(pdev, host); ret = dw_mci_probe(host); - if (ret) - goto err_out; - return ret; -err_out: - iounmap(host->regs); -err_free: - kfree(host); return ret; } @@ -68,8 +57,6 @@ static int __devexit dw_mci_pltfm_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); dw_mci_remove(host); - iounmap(host->regs); - kfree(host); return 0; }