linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Himangi Saraogi <himangi774@gmail.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: Re: [PATCH] usb: host: xhci-plat: use devm_functions
Date: Fri, 20 Jun 2014 22:03:23 +0400	[thread overview]
Message-ID: <53A4776B.8010208@cogentembedded.com> (raw)
In-Reply-To: <20140620164853.GA5798@himangi-Dell>

Hello.

On 06/20/2014 08:48 PM, Himangi Saraogi wrote:

> This patch introduces the use of managed interface devm_ioremap_resource
> for ioremap_nocache and request_mem_region and removes the corresponding
> free functions in the probe and remove functions.

> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
>   drivers/usb/host/xhci-plat.c | 25 +++++--------------------
>   1 file changed, 5 insertions(+), 20 deletions(-)

> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 29d8adb..31d14a5 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -140,18 +140,11 @@ static int xhci_plat_probe(struct platform_device *pdev)
>   	hcd->rsrc_start = res->start;
>   	hcd->rsrc_len = resource_size(res);
>
> -	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
> -				driver->description)) {
> -		dev_dbg(&pdev->dev, "controller already in use\n");
> -		ret = -EBUSY;
> -		goto put_hcd;
> -	}
> -
> -	hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
> -	if (!hcd->regs) {
> +	hcd->regs = devm_ioremap_resource(&pdev->dev, res);
> +	if (IS_ERR(hcd->regs)) {
>   		dev_dbg(&pdev->dev, "error mapping memory\n");

    This line is worth removing -- devm_ioremap_resource() complains loudly on 
errors.

> -		ret = -EFAULT;
> -		goto release_mem_region;
> +		ret = PTR_ERR(hcd->regs);
> +		goto put_hcd;
>   	}

WBR, Sergei


  parent reply	other threads:[~2014-06-20 18:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 16:48 [PATCH] usb: host: xhci-plat: use devm_functions Himangi Saraogi
2014-06-20 16:57 ` Felipe Balbi
2014-06-20 18:03 ` Sergei Shtylyov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-20 17:41 Himangi Saraogi
2014-06-20 17:55 ` Felipe Balbi

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=53A4776B.8010208@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=himangi774@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.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).