From patchwork Sun Aug 26 11:52:00 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: 10952 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 5207E23EFE for ; Sun, 26 Aug 2012 11:34:18 +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 C702BA182F8 for ; Sun, 26 Aug 2012 11:33:54 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so3776090iaf.11 for ; Sun, 26 Aug 2012 04:34:17 -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=J/8fPY0PqzrE3w5tDhRXaCihO8YiE5wnL5Pbevoqdik=; b=fTBbDpmlF4zCRUGJ28j5XQvrZGr+7mJG1WxdopkuINxFBnACeH9NDeMvu51VqyaU/m lyT5j3mvyeF9MnrNpdOhvhHgzSeKd+Dpuno0/nEpe0VoFXHEk84OITttfG77ruQr67Vx CpAdjBwsfBoiMj1JAZtO0c3YEKTo6zSORrc8//Ydjc468IHmAhxUcbxnxSzHJm69pGf+ 3l0kkcawLTC6gkTN3hAXOHisvsypmVoLvtZMUAlxdDKROz3iCJ5Oqji10oNyp1M2/NnZ dUNbkIPa2Q1cAQonqZmsthr0DZh24zAGecDvvTHDHwQn9XQqOpTkK2oLLmI8QmxemFEf UHPg== Received: by 10.50.10.201 with SMTP id k9mr7229770igb.28.1345980857668; Sun, 26 Aug 2012 04:34:17 -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 ex8csp396424igc; Sun, 26 Aug 2012 04:34:17 -0700 (PDT) Received: by 10.66.74.3 with SMTP id p3mr22915545pav.49.1345980857142; Sun, 26 Aug 2012 04:34:17 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id px5si27200248pbb.232.2012.08.26.04.34.16; Sun, 26 Aug 2012 04:34:17 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 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 mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9D006XB1GZK000@mailout1.samsung.com>; Sun, 26 Aug 2012 20:34:16 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-38-503a09b790ee Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 56.4A.17335.7B90A305; Sun, 26 Aug 2012 20:34:16 +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 <0M9D00AQQ1GN7UA0@mmp1.samsung.com>; Sun, 26 Aug 2012 20:34:15 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: 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 v4 2/9] mmc: dw_mmc: Use devm_* functions in dw_mmc platform driver Date: Sun, 26 Aug 2012 17:22:00 +0530 Message-id: <1345981927-26359-3-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1345981927-26359-1-git-send-email-thomas.abraham@linaro.org> References: <1345981927-26359-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOJMWRmVeSWpSXmKPExsVy+t9jAd0dnFYBBk/LLb58PcFmMeXwFxYH Jo871/awBTBGcdmkpOZklqUW6dslcGW8XLafqeAqb8XCX/vYGxi7ubsYOTgkBEwkpjeodDFy ApliEhfurWfrYuTiEBJYxCgx6conVginjUmi798+RpAqNgEDiUcL37GD2CICThJL5k5gBili FnjJKDFz10w2kISwQKjExnl9YA0sAqoS5y5MYgGxeQU8JTr/3WeFWKcksaH3KBOIzSngJXFj USvYUCGgmuMzvjNOYORdwMiwilE0tSC5oDgpPddQrzgxt7g0L10vOT93EyPY+8+kdjCubLA4 xCjAwajEwytQahkgxJpYVlyZe4hRgoNZSYT3+36gEG9KYmVValF+fFFpTmrxIUZpDhYlcV7+ PsMAIYH0xJLU7NTUgtQimCwTB6dUA6PkzukLmT/vtle43GDOl3m8Z/ekjva9nTcvts15F/Zl omqfjdZGcYOjjFffrph2Y0nq6mvNX5co3VL1qJPMqIqym5m8L//KigebzSo91jW7Sq+9+tuT 22B+JZNhzgJHcV+hMybtgnO/lUVkK8n96upfv8hBffGc5+xL81tXCajNcprV/MEpcoYSS3FG oqEWc1FxIgCoIxwc+gEAAA== X-Gm-Message-State: ALoCoQky9JdIAo4R4s6qfkS8fp/9RErDru004P3vW23YETF3kWwlt6tn5eB1NF5jDM9unOeol4Un Use devm_* managed functions for simpler error handling. Signed-off-by: Thomas Abraham --- 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 9a63299..1488b17 100644 --- a/drivers/mmc/host/dw_mmc-pltfm.c +++ b/drivers/mmc/host/dw_mmc-pltfm.c @@ -27,38 +27,27 @@ static int 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 __exit dw_mci_pltfm_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); dw_mci_remove(host); - iounmap(host->regs); - kfree(host); return 0; }