public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <me@felipebalbi.com>
To: Felipe Balbi <me@felipebalbi.com>
Cc: David Brownell <david-b@pacbell.net>,
	felipe.balbi@nokia.com,
	Linux OMAP Mailing List <linux-omap@vger.kernel.org>
Subject: Re: [patch] omap: usb: ehci: fix use of hcd->regs
Date: Fri, 12 Sep 2008 21:22:56 +0300	[thread overview]
Message-ID: <20080912182255.GD7132@frodo> (raw)
In-Reply-To: <20080912175033.GB7132@frodo>

On Fri, Sep 12, 2008 at 08:50:33PM +0300, Felipe Balbi wrote:
> On Fri, Sep 12, 2008 at 09:32:56AM -0700, David Brownell wrote:
> > On Friday 12 September 2008, Felipe Balbi wrote:
> > > -       hcd->regs = (void __iomem *) (int) IO_ADDRESS(hcd->rsrc_start);
> > > +       hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
> > 
> > This is missing its sibling iounmap() ...
> 
> God... thanks Dave. Good catch. Patch coming soonish.

Here's the updated version. While at it, I'll send another patch getting
rid of some other mistakes during probe.

===== cut here ====

From 818dc8ebd261cdc59670fe1580248ad47f18a1de Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Fri, 12 Sep 2008 21:07:09 +0300
Subject: [PATCH] omap: usb: ehci: fix usb of hcd->regs

hcd->regs should be initialized by ioremaping hcd->rsrc_start and
hcd->rsrc_len. Fix it for ehci-omap.c.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/usb/host/ehci-omap.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 8f122e5..fff4195 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -438,7 +438,11 @@ static int ehci_hcd_omap_drv_probe(struct platform_device *dev)
 	hcd->rsrc_start = dev->resource[0].start;
 	hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
 
-	hcd->regs = (void __iomem *) (int) IO_ADDRESS(hcd->rsrc_start);
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {
+		dev_err(&dev->dev, "ioremap failed\n");
+		return -ENOMEM;
+	}
 
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = hcd->regs;
@@ -457,8 +461,9 @@ static int ehci_hcd_omap_drv_probe(struct platform_device *dev)
 
 	dev_dbg(hcd->self.controller, "ERR: add_hcd");
 	omap_stop_ehc(dev, hcd);
-
+	iounmap(hcd->regs);
 	usb_put_hcd(hcd);
+
 	return retval;
 }
 
@@ -483,6 +488,7 @@ static int ehci_hcd_omap_drv_remove(struct platform_device *dev)
 
 	dev_dbg(&dev->dev, "ehci_hcd_omap_drv_remove()");
 
+	iounmap(hcd->regs);
 	usb_remove_hcd(hcd);
 	usb_put_hcd(hcd);
 	omap_stop_ehc(dev, hcd);
-- 
1.6.0.1.196.g01914

-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-09-12 18:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-12 12:10 [patch] omap: usb: ehci: fix use of hcd->regs Felipe Balbi
2008-09-12 12:14 ` Hiroshi DOYU
2008-09-12 12:30   ` Felipe Balbi
2008-09-12 13:37     ` Hiroshi DOYU
2008-09-14 18:53       ` Pandita, Vikram
2008-09-12 16:32 ` David Brownell
2008-09-12 17:50   ` Felipe Balbi
2008-09-12 18:22     ` Felipe Balbi [this message]
2008-09-12 18:38       ` [rfc] [patch] clean up to ehci-omap (Was: Re: [patch] omap: usb: ehci: fix use of hcd->regs) Felipe Balbi
2008-09-12 19:16         ` David Brownell
2008-09-12 19:21           ` Tony Lindgren
2008-09-12 19:28             ` Felipe Balbi
2008-09-12 19:29               ` Felipe Balbi
2008-09-12 19:35               ` Felipe Balbi
2008-09-14 18:41                 ` Pandita, Vikram
2008-09-14 18:57                   ` Felipe Balbi
2008-09-16  5:47                     ` David Brownell
2008-09-16  7:26                       ` Felipe Balbi
2008-09-16  5:48                     ` David Brownell
2008-09-16  6:05                       ` Gadiyar, Anand
2008-09-16  6:35                         ` David Brownell
2008-09-16  7:28                       ` Felipe Balbi
2008-09-16  5:49                     ` David Brownell
2008-09-16  8:28                       ` Felipe Balbi
2008-09-18  9:35                     ` Gadiyar, Anand
2008-09-21 23:28                       ` Paul Walmsley
2008-09-22 15:17                   ` Felipe Balbi
2008-09-22 15:21                     ` Gadiyar, Anand
2008-09-22 15:26                       ` Felipe Balbi
2008-09-22 15:30                         ` Gadiyar, Anand
2008-09-22 15:32                           ` Felipe Balbi
2008-09-12 20:01               ` Gadiyar, Anand
2008-09-12 20:30                 ` David Brownell
2008-09-12 20:54                   ` Gadiyar, Anand
2008-09-12 21:15                     ` David Brownell
2008-09-12 20:38                 ` Felipe Balbi
2008-09-12 21:06                   ` Gadiyar, Anand
2008-09-12 22:18                     ` Steve Sakoman
2008-09-12 23:54       ` [patch] omap: usb: ehci: fix use of hcd->regs Tony Lindgren

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=20080912182255.GD7132@frodo \
    --to=me@felipebalbi.com \
    --cc=david-b@pacbell.net \
    --cc=felipe.balbi@nokia.com \
    --cc=linux-omap@vger.kernel.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