Răsfoiți Sursa

ehci-hcd: Cleanup memory resources when ehci_halt fails

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>
Jia-Ju Bai 9 ani în urmă
părinte
comite
d8ff463a4e
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      drivers/usb/host/ehci-hcd.c

+ 3 - 1
drivers/usb/host/ehci-hcd.c

@@ -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);