From: Thomas Abraham <thomas.abraham@linaro.org>
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 [thread overview]
Message-ID: <1345981927-26359-3-git-send-email-thomas.abraham@linaro.org> (raw)
In-Reply-To: <1345981927-26359-1-git-send-email-thomas.abraham@linaro.org>
Use devm_* managed functions for simpler error handling.
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
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;
}
--
1.6.6.rc2
next prev parent reply other threads:[~2012-08-26 11:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-26 11:51 [PATCH v4 0/9] mmc: dw_mmc: add support for device tree based instantiation Thomas Abraham
2012-08-26 11:51 ` [PATCH v4 1/9] mmc: dw_mmc: convert copy of struct device in struct dw_mci to a reference Thomas Abraham
2012-08-26 11:52 ` Thomas Abraham [this message]
2012-08-26 11:52 ` [PATCH v4 3/9] mmc: dw_mmc: allow probe to succeed even if one slot is initialized Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 4/9] mmc: dw_mmc: lookup for optional biu and ciu clocks Thomas Abraham
2012-08-28 10:43 ` Seungwon Jeon
2012-08-28 11:23 ` Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 5/9] mmc: dw_mmc: add quirk to indicate missing write protect line Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 6/9] mmc: dw_mmc: add device tree support Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 7/9] mmc: dw_mmc: prepare functions in dw_mmc-pltfm for reuse Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 8/9] mmc: dw_mmc: add support for implementation specific callbacks Thomas Abraham
2012-08-26 11:52 ` [PATCH v4 9/9] mmc: dw_mmc: add support for exynos specific implementation of dw-mshc Thomas Abraham
2012-08-27 8:58 ` Jaehoon Chung
2012-08-28 4:48 ` Thomas Abraham
2012-08-28 4:55 ` Jaehoon Chung
2012-08-28 5:10 ` Thomas Abraham
2012-08-28 5:10 ` Thomas Abraham
2012-08-28 5:16 ` Jaehoon Chung
2012-08-28 5:20 ` Thomas Abraham
2012-08-28 7:06 ` Seungwon Jeon
2012-08-28 7:42 ` Thomas Abraham
2012-08-28 10:43 ` Seungwon Jeon
2012-08-28 11:35 ` Thomas Abraham
2012-08-27 9:31 ` [PATCH v4 0/9] mmc: dw_mmc: add support for device tree based instantiation Will Newton
2012-08-28 4:52 ` Thomas Abraham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1345981927-26359-3-git-send-email-thomas.abraham@linaro.org \
--to=thomas.abraham@linaro.org \
--cc=cjb@laptop.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=girish.shivananjappa@linaro.org \
--cc=grant.likely@secretlab.ca \
--cc=jh80.chung@samsung.com \
--cc=kgene.kim@samsung.com \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=patches@linaro.org \
--cc=rob.herring@calxeda.com \
--cc=tgih.jun@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).