From patchwork Wed Aug 29 10:48:08 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: 11016 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 0B36623EFF for ; Wed, 29 Aug 2012 10:30:12 +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 749AAA188FF for ; Wed, 29 Aug 2012 10:29:39 +0000 (UTC) Received: by iafj25 with SMTP id j25so734260iaf.11 for ; Wed, 29 Aug 2012 03:30:10 -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=EQMwxNWGn6HgiYvTUwOJAKu8NGupPb+s50YIpO3p1eUzVhlCUnJWSS5bNSMI3kexlw u7RPHZ59OYqCM4t+Tn1oJhpTC552nhl1kJD4PtmCd/rDmkT7K2+krn4xEmnyWhYPtKWP V6IfRuqIQTPchL1kA9IQQ3zfb+9w3dyCjdQtd2deYV9sxAkczvwfFkUIcedfb7vzpm7s SkpymSqcClDL/TdM2ipqaiChmDqA2OpxcXWzXkMLTX39L/Z+poFCewq2EbDQJeWw9eMB s1Bx8Ny/O98eQAygueV0NGpGKXVS77V0QFbG/LU5ghPngPDrmPTsVBIryiKyKRWeWDSa pfrA== Received: by 10.50.242.3 with SMTP id wm3mr6292784igc.0.1346236210783; Wed, 29 Aug 2012 03:30:10 -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 ex8csp77409igc; Wed, 29 Aug 2012 03:30:10 -0700 (PDT) Received: by 10.68.191.226 with SMTP id hb2mr3638452pbc.129.1346236209918; Wed, 29 Aug 2012 03:30:09 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id pv1si41709232pbb.179.2012.08.29.03.30.08; Wed, 29 Aug 2012 03:30:09 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9I00CPJIHKH311@mailout4.samsung.com>; Wed, 29 Aug 2012 19:30:07 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-5a-503def2f16aa Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 23.2F.18282.F2FED305; Wed, 29 Aug 2012 19:30:07 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M9I004F3IHPXG70@mmp2.samsung.com>; Wed, 29 Aug 2012 19:30:07 +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 v5 2/9] mmc: dw_mmc: Use devm_* functions in dw_mmc platform driver Date: Wed, 29 Aug 2012 16:18:08 +0530 Message-id: <1346237295-7116-3-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1346237295-7116-1-git-send-email-thomas.abraham@linaro.org> References: <1346237295-7116-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t9jQV3997YBBlv+Sll8+XqCzWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKePj8H2vBJL6KSY8WsjUwHuLuYuTkkBAwkTi4azk7 hC0mceHeerYuRi4OIYHpjBKLH16BctqYJBqPbGcFqWITMJB4tPAdWIeIgJPEkrkTmEGKmAUa mSQ2LtzJBpIQFgiVOHT7HpjNIqAqsetQCxOIzSvgIXGncz3UOiWJDb1HweKcAp4S71ZeAasX Aqr5fW8l2wRG3gWMDKsYRVMLkguKk9JzjfSKE3OLS/PS9ZLzczcxggPgmfQOxlUNFocYBTgY lXh4L3DbBgixJpYVV+YeYpTgYFYS4U19BRTiTUmsrEotyo8vKs1JLT7EKM3BoiTOy99nGCAk kJ5YkpqdmlqQWgSTZeLglGpgjC771mS4ynvHaqtA7VXHn8k36oZ/E7dX33Xu9oFA+dMLZTte JzSJnhDleZ7zPy78WlxQ9F6tuk81e3bKelXPn9KaEr+Cq/yzjfgmzrqnFxL5QtqzGWyKtk0J fMc0h/v0a6XVqXXXes9vFAoU3d6ldOGxsZXizLOcZ+pfx0srXc/zkvnV/nCnEktxRqKhFnNR cSIA+QkwMfwBAAA= X-Gm-Message-State: ALoCoQlYhPA3x+ZLccDipn+XJZTVSXk6D5nE05s6UmZVeZ4G1sjNriXz0H5e7qQQLdO9ZeGrprOg 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; }