From xiphmont@gmail.com Thu Nov 30 12:36:57 2006 Message-ID: <806dafc20611301230u1244d9e6x5cfd7739563ec717@mail.gmail.com> Date: Thu, 30 Nov 2006 15:30:11 -0500 From: Monty Montgomery To: greg@kroah.com, linux-usb-devel@lists.sourceforge.net Subject: ehci: eliminate fstn leaks on ehci shutdown From: Monty Montgomery This patch eliminates fstn leakage on controller driver shutdown. The visible effect is to eliminate 'dma_pool_destroy ehci_fstn, xxxxxxxx busy' messages on ehci-hcd module removal. Signed-off-by: Monty Montgomery Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-mem.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- gregkh-2.6.orig/drivers/usb/host/ehci-mem.c +++ gregkh-2.6/drivers/usb/host/ehci-mem.c @@ -155,6 +155,7 @@ static inline void qh_put (struct ehci_q static void ehci_mem_cleanup (struct ehci_hcd *ehci) { + int i; if (ehci->async) qh_put (ehci->async); ehci->async = NULL; @@ -164,6 +165,17 @@ static void ehci_mem_cleanup (struct ehc dma_pool_destroy (ehci->qtd_pool); ehci->qtd_pool = NULL; + /* previously used FSTNs are all cached; free them */ + if(ehci->periodic_save_fstns){ + for(i=0;iperiodic_save_fstns[i]) + ehci_fstn_free(ehci,ehci->periodic_save_fstns[i]); + kfree(ehci->periodic_save_fstns); + } + + if(ehci->periodic_restore_fstn) + ehci_fstn_free(ehci,ehci->periodic_restore_fstn); + if (ehci->fstn_pool) dma_pool_destroy (ehci->fstn_pool); ehci->fstn_pool = NULL; @@ -187,8 +199,6 @@ static void ehci_mem_cleanup (struct ehc ehci->periodic, ehci->periodic_dma); ehci->periodic = NULL; - if(ehci->periodic_save_fstns) - kfree(ehci->periodic_save_fstns); if(ehci->budget) kfree(ehci->budget); ehci->budget = NULL;