]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ehci-hcd: Cleanup memory resources when ehci_halt fails
authorJia-Ju Bai <baijiaju1990@163.com>
Mon, 4 Jan 2016 08:14:43 +0000 (16:14 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jan 2016 04:51:34 +0000 (20:51 -0800)
The driver calls ehci_mem_init to allocate memory resources.
But these resources are not freed when ehci_halt fails.

This patch adds "ehci_mem_cleanup" in error handling code to fix this problem.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-hcd.c

index 14178bbf069496aba61a03ab3589945d9bbf721a..00e77cc91053a48cf6b9ea1e5f2d5bd49b468403 100644 (file)
@@ -675,8 +675,10 @@ int ehci_setup(struct usb_hcd *hcd)
                return retval;
 
        retval = ehci_halt(ehci);
-       if (retval)
+       if (retval) {
+               ehci_mem_cleanup(ehci);
                return retval;
+       }
 
        ehci_reset(ehci);