From: Guenter Roeck <linux@roeck-us.net>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "'Andrew Morton'" <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
"'Wim Van Sebroeck'" <wim@iguana.be>,
linux-watchdog@vger.kernel.org
Subject: Re: [PATCH RESEND 7/7] watchdog: ts72xx_wdt: use devm_*() functions
Date: Mon, 29 Apr 2013 11:09:57 -0700 [thread overview]
Message-ID: <20130429180957.GG5183@roeck-us.net> (raw)
In-Reply-To: <001101ce44bd$0a0105f0$1e0311d0$@samsung.com>
On Mon, Apr 29, 2013 at 06:36:34PM +0900, Jingoo Han wrote:
> Use devm_*() functions to make cleanup paths simpler.
>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/watchdog/ts72xx_wdt.c | 64 +++++++----------------------------------
> 1 files changed, 11 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c
> index b8a9245..b19ca75 100644
> --- a/drivers/watchdog/ts72xx_wdt.c
> +++ b/drivers/watchdog/ts72xx_wdt.c
> @@ -396,7 +396,7 @@ static int ts72xx_wdt_probe(struct platform_device *pdev)
> struct resource *r1, *r2;
> int error = 0;
>
> - wdt = kzalloc(sizeof(struct ts72xx_wdt), GFP_KERNEL);
> + wdt = devm_kzalloc(&pdev->dev, sizeof(struct ts72xx_wdt), GFP_KERNEL);
> if (!wdt) {
> dev_err(&pdev->dev, "failed to allocate memory\n");
> return -ENOMEM;
> @@ -405,44 +405,22 @@ static int ts72xx_wdt_probe(struct platform_device *pdev)
> r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (!r1) {
> dev_err(&pdev->dev, "failed to get memory resource\n");
> - error = -ENODEV;
> - goto fail;
> - }
> -
> - r1 = request_mem_region(r1->start, resource_size(r1), pdev->name);
> - if (!r1) {
> - dev_err(&pdev->dev, "cannot request memory region\n");
> - error = -EBUSY;
> - goto fail;
> + return -ENODEV;
> }
>
> - wdt->control_reg = ioremap(r1->start, resource_size(r1));
> - if (!wdt->control_reg) {
> - dev_err(&pdev->dev, "failed to map memory\n");
> - error = -ENODEV;
> - goto fail_free_control;
> - }
> + wdt->control_reg = devm_ioremap_resource(&pdev->dev, r1);
> + if (IS_ERR(wdt->control_reg))
> + return PTR_ERR(wdt->control_reg);
>
> r2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> if (!r2) {
> dev_err(&pdev->dev, "failed to get memory resource\n");
> - error = -ENODEV;
> - goto fail_unmap_control;
> + return -ENODEV;
> }
>
> - r2 = request_mem_region(r2->start, resource_size(r2), pdev->name);
> - if (!r2) {
> - dev_err(&pdev->dev, "cannot request memory region\n");
> - error = -EBUSY;
> - goto fail_unmap_control;
> - }
> -
> - wdt->feed_reg = ioremap(r2->start, resource_size(r2));
> - if (!wdt->feed_reg) {
> - dev_err(&pdev->dev, "failed to map memory\n");
> - error = -ENODEV;
> - goto fail_free_feed;
> - }
> + wdt->feed_reg = devm_ioremap_resource(&pdev->dev, r2);
> + if (IS_ERR(wdt->feed_reg))
> + return PTR_ERR(wdt->feed_reg);
>
You have a mix of returns with and without error messages now. Can you make sure
that this is all consistent ?
Thanks,
Guenter
next prev parent reply other threads:[~2013-04-29 18:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 9:36 Jingoo Han
2013-04-29 18:09 ` Guenter Roeck [this message]
2013-04-30 2:18 ` Jingoo Han
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=20130429180957.GG5183@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=jg1.han@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/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
all inboxes | Powered by JetHome®