linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Sonic Zhang <sonic.adi-Re5JQEeQqe8AvxtiuMwx3w@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: Wed, 21 May 2014 10:05:30 +0200	[thread overview]
Message-ID: <20140521080530.GD2708@katana> (raw)
In-Reply-To: <1394445784-4653-1-git-send-email-sonic.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]


> @@ -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.

> -	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?

> @@ -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?


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-05-21  8:05 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 [this message]
2014-05-22  9:12     ` Sonic Zhang

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=20140521080530.GD2708@katana \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=adi-buildroot-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sonic.adi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sonic.zhang-OyLXuOCK7orQT0dZR+AlfA@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).