Re: [PATCH] ehci-hcd: Cleanup memory resources when ehci_halt fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/29/2015 12:04 AM, Alan Stern wrote:
On Mon, 28 Dec 2015, Jia-Ju Bai wrote:

Please add a changelog.

Signed-off-by: Jia-Ju Bai<baijiaju1990@xxxxxxx>
---
  drivers/usb/host/ehci-hcd.c |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 48c92bf..015b411 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/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;
+	}
I would prefer to see the call to ehci_mem_init() moved into
ehci_setup() as well, so that we don't do mem_init in one routine and
mem_cleanup in another.

Alan Stern


Thanks ^_^
I will add the changelog.

I find that it is a little hard to move ehci_mem_init into ehci_setup.
In the code, ehci_mem_init needs data (ehci->periodic_size) in ehci_init to allocate memory, and some data (ehci->async->hw) in ehci_init needs the memory allocated by ehci_mem_init.
Thus, moving ehci_mem_init out of ehci_init needs much modification.
I think the easiest way is to call echi_mem_cleanup here (in ehci_setup).

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux