From: Sonic Zhang <sonic.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Sonic Zhang <sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] i2c: bfin: turn to Resource-managed API in probe function
Date: Thu, 22 May 2014 17:12:49 +0800 [thread overview]
Message-ID: <CAJxxZ0PqQmOp6r9-yrr7OReQZ1Y6aRSBEDzTv0d++P9gvbkd6w@mail.gmail.com> (raw)
In-Reply-To: <20140521080530.GD2708@katana>
Hi Wolfram,
On Wed, May 21, 2014 at 4:05 PM, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote:
>
>> @@ -646,22 +646,19 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> if (res == NULL) {
>> dev_err(&pdev->dev, "Cannot get IORESOURCE_MEM\n");
>> - rc = -ENOENT;
>> - goto out_error_get_res;
>> + return -ENOENT;
>
> You don't need to check the resource. devm_ioremap_resource will do it.
OK
>
>> - iface->regs_base = ioremap(res->start, resource_size(res));
>> - if (iface->regs_base == NULL) {
>> + iface->regs_base = devm_ioremap_resource(&pdev->dev, res);
>> + if (IS_ERR((void *)iface->regs_base)) {
>> dev_err(&pdev->dev, "Cannot map IO\n");
>> - rc = -ENXIO;
>> - goto out_error_ioremap;
>> + return PTR_ERR((void *)iface->regs_base);
>
> Do we need the casts?
No. I will remove the cast.
>
>> @@ -740,8 +728,6 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev)
>> i2c_del_adapter(&(iface->adap));
>> free_irq(iface->irq, iface);
>> peripheral_free_list(dev_get_platdata(&pdev->dev));
>> - iounmap(iface->regs_base);
>> - kfree(iface);
>
> You missed to remove the free irq.
>
> Have you actually tried unloading the module?
>
Ok. The free_irq should be removed.
I will send a new patch.
Thank you.
Sonic
prev parent reply other threads:[~2014-05-22 9:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 10:03 [PATCH] i2c: bfin: turn to Resource-managed API in probe function Sonic Zhang
[not found] ` <1394445784-4653-1-git-send-email-sonic.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-03-25 8:42 ` Sonic Zhang
2014-05-21 8:05 ` Wolfram Sang
2014-05-22 9:12 ` Sonic Zhang [this message]
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=CAJxxZ0PqQmOp6r9-yrr7OReQZ1Y6aRSBEDzTv0d++P9gvbkd6w@mail.gmail.com \
--to=sonic.adi-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
/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).