aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@lip6.fr>2012-07-29 15:46:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-10 15:01:33 -0400
commit8ca41ae35f5567280eac787a9cc9bcd5988b9f82 (patch)
treee3c4d9f2c3adc6558e2c3d151da3db6458482efc
parent979834313271203d1e6e84241cc3aca4503a3dbb (diff)
drivers/usb/host/ehci-au1xxx.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/ehci-au1xxx.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index cba10d625a5d..65c945eb4144 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -98,23 +98,17 @@ static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
98 hcd->rsrc_start = res->start; 98 hcd->rsrc_start = res->start;
99 hcd->rsrc_len = resource_size(res); 99 hcd->rsrc_len = resource_size(res);
100 100
101 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 101 hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
102 pr_debug("request_mem_region failed");
103 ret = -EBUSY;
104 goto err1;
105 }
106
107 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
108 if (!hcd->regs) { 102 if (!hcd->regs) {
109 pr_debug("ioremap failed"); 103 pr_debug("devm_request_and_ioremap failed");
110 ret = -ENOMEM; 104 ret = -ENOMEM;
111 goto err2; 105 goto err1;
112 } 106 }
113 107
114 if (alchemy_usb_control(ALCHEMY_USB_EHCI0, 1)) { 108 if (alchemy_usb_control(ALCHEMY_USB_EHCI0, 1)) {
115 printk(KERN_INFO "%s: controller init failed!\n", pdev->name); 109 printk(KERN_INFO "%s: controller init failed!\n", pdev->name);
116 ret = -ENODEV; 110 ret = -ENODEV;
117 goto err3; 111 goto err1;
118 } 112 }
119 113
120 ret = usb_add_hcd(hcd, pdev->resource[1].start, 114 ret = usb_add_hcd(hcd, pdev->resource[1].start,
@@ -125,10 +119,6 @@ static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
125 } 119 }
126 120
127 alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); 121 alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
128err3:
129 iounmap(hcd->regs);
130err2:
131 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
132err1: 122err1:
133 usb_put_hcd(hcd); 123 usb_put_hcd(hcd);
134 return ret; 124 return ret;
@@ -140,8 +130,6 @@ static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
140 130
141 usb_remove_hcd(hcd); 131 usb_remove_hcd(hcd);
142 alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); 132 alchemy_usb_control(ALCHEMY_USB_EHCI0, 0);
143 iounmap(hcd->regs);
144 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
145 usb_put_hcd(hcd); 133 usb_put_hcd(hcd);
146 platform_set_drvdata(pdev, NULL); 134 platform_set_drvdata(pdev, NULL);
147 135