[PATCH] usb: host: ehci-atmel: stop clocks before releasing HCD

Hongyan Xu <[email protected]>
Newsgroups gmane.linux.usb.general,gmane.linux.ports.arm.kernel
Message-ID <[email protected]>
usb_put_hcd() drops the driver's HCD reference and can free the HCD and its
private data. The remove callback then calls atmel_stop_ehci(), which
obtains that HCD from platform data and dereferences its private data to
disable the clocks.

Stop the controller clocks before dropping the HCD reference so that
atmel_stop_ehci() cannot access an already freed HCD.

Fixes: 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")
Signed-off-by: Hongyan Xu <[email protected]>
---
 drivers/usb/host/ehci-atmel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 65747270fd88..bcd56f888ec9 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -177,9 +177,8 @@ static void ehci_atmel_drv_remove(struct platform_device *pdev)
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 
 	usb_remove_hcd(hcd);
-	usb_put_hcd(hcd);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.