aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2014-05-28 16:51:13 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-28 17:53:53 -0400
commit5dc2808c4729bf080487e61b80ee04e0fdb12a37 (patch)
tree142c2993c2c8d18ed656b397cedf1d181f91b125
parentb38f09ccc3fd453180e96273bf3f34083c30809a (diff)
xhci: delete endpoints from bandwidth list before freeing whole device
Lists of endpoints are stored for bandwidth calculation for roothub ports. Make sure we remove all endpoints from the list before the whole device, containing its endpoints list_head stuctures, is freed. This used to be done in the wrong order in xhci_mem_cleanup(), and triggered an oops in resume from S4 (hibernate). Cc: stable <stable@vger.kernel.org> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-mem.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index c089668308ad..b1a8a5f4bbb8 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1822,6 +1822,16 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1822 kfree(cur_cd); 1822 kfree(cur_cd);
1823 } 1823 }
1824 1824
1825 num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
1826 for (i = 0; i < num_ports; i++) {
1827 struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
1828 for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
1829 struct list_head *ep = &bwt->interval_bw[j].endpoints;
1830 while (!list_empty(ep))
1831 list_del_init(ep->next);
1832 }
1833 }
1834
1825 for (i = 1; i < MAX_HC_SLOTS; ++i) 1835 for (i = 1; i < MAX_HC_SLOTS; ++i)
1826 xhci_free_virt_device(xhci, i); 1836 xhci_free_virt_device(xhci, i);
1827 1837
@@ -1857,16 +1867,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1857 if (!xhci->rh_bw) 1867 if (!xhci->rh_bw)
1858 goto no_bw; 1868 goto no_bw;
1859 1869
1860 num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
1861 for (i = 0; i < num_ports; i++) {
1862 struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
1863 for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
1864 struct list_head *ep = &bwt->interval_bw[j].endpoints;
1865 while (!list_empty(ep))
1866 list_del_init(ep->next);
1867 }
1868 }
1869
1870 for (i = 0; i < num_ports; i++) { 1870 for (i = 0; i < num_ports; i++) {
1871 struct xhci_tt_bw_info *tt, *n; 1871 struct xhci_tt_bw_info *tt, *n;
1872 list_for_each_entry_safe(tt, n, &xhci->rh_bw[i].tts, tt_list) { 1872 list_for_each_entry_safe(tt, n, &xhci->rh_bw[i].tts, tt_list) {