The devm_ functions allocate memory that is released when a driver
detaches. This makes the code smaller and a bit simpler.

Signed-off-by: Jingoo Han <[email protected]>
---
 drivers/usb/host/ohci-s3c2410.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 0d2309c..383aa2c 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -323,7 +323,6 @@ usb_hcd_s3c2410_remove(struct usb_hcd *hcd, struct 
platform_device *dev)
 {
        usb_remove_hcd(hcd);
        s3c2410_stop_hc(dev);
-       iounmap(hcd->regs);
        release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
        usb_put_hcd(hcd);
 }
@@ -359,23 +358,23 @@ static int usb_hcd_s3c2410_probe(const struct hc_driver 
*driver,
                goto err_put;
        }
 
-       clk = clk_get(&dev->dev, "usb-host");
+       clk = devm_clk_get(&dev->dev, "usb-host");
        if (IS_ERR(clk)) {
                dev_err(&dev->dev, "cannot get usb-host clock\n");
                retval = PTR_ERR(clk);
                goto err_mem;
        }
 
-       usb_clk = clk_get(&dev->dev, "usb-bus-host");
+       usb_clk = devm_clk_get(&dev->dev, "usb-bus-host");
        if (IS_ERR(usb_clk)) {
                dev_err(&dev->dev, "cannot get usb-bus-host clock\n");
                retval = PTR_ERR(usb_clk);
-               goto err_clk;
+               goto err_mem;
        }
 
        s3c2410_start_hc(dev, hcd);
 
-       hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+       hcd->regs = devm_ioremap(&dev->dev, hcd->rsrc_start, hcd->rsrc_len);
        if (!hcd->regs) {
                dev_err(&dev->dev, "ioremap failed\n");
                retval = -ENOMEM;
@@ -392,11 +391,6 @@ static int usb_hcd_s3c2410_probe(const struct hc_driver 
*driver,
 
  err_ioremap:
        s3c2410_stop_hc(dev);
-       iounmap(hcd->regs);
-       clk_put(usb_clk);
-
- err_clk:
-       clk_put(clk);
 
  err_mem:
        release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to