From e423e270d8b1f363e294abd7f9c6e763f34267de Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 1 Jun 2012 10:06:23 +0200 Subject: [PATCH] --- yaml --- r: 310911 b: refs/heads/master c: 46ed8f00d8982e49f8fe2c1a9cea192f640cb3ba h: refs/heads/master i: 310909: 1780256b2d6d3b4d40dcd8e35b4cf773acd9b74a 310907: 80e0643bc611854f9c7e5734038c792821cfe45a 310903: 36aeb4f216ab64bbdd0530cfbc6ce7b4da72cf04 310895: 7cb6ba990e88df24ce42bcdd61382a6f217193dc 310879: f8ebc5c2c7a6a428eacd7426f36cc5e4b32338df 310847: 46ef8f36a4ae2d278df58f2a547fcc702cc3137e 310783: 53570ff2cc94611e55de0c1279d4ab6080b014a3 v: v3 --- [refs] | 2 +- trunk/drivers/usb/host/xhci-mem.c | 39 ++++++++----------------------- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/[refs] b/[refs] index c0713079dfc6..761870797f98 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e25e62aecac42379e113c63a674a86ae3ebbec8d +refs/heads/master: 46ed8f00d8982e49f8fe2c1a9cea192f640cb3ba diff --git a/trunk/drivers/usb/host/xhci-mem.c b/trunk/drivers/usb/host/xhci-mem.c index ec4338eec826..898dfc8bc520 100644 --- a/trunk/drivers/usb/host/xhci-mem.c +++ b/trunk/drivers/usb/host/xhci-mem.c @@ -793,10 +793,9 @@ static void xhci_free_tt_info(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, int slot_id) { - struct list_head *tt; struct list_head *tt_list_head; - struct list_head *tt_next; - struct xhci_tt_bw_info *tt_info; + struct xhci_tt_bw_info *tt_info, *next; + bool slot_found = false; /* If the device never made it past the Set Address stage, * it may not have the real_port set correctly. @@ -808,34 +807,16 @@ static void xhci_free_tt_info(struct xhci_hcd *xhci, } tt_list_head = &(xhci->rh_bw[virt_dev->real_port - 1].tts); - if (list_empty(tt_list_head)) - return; - - list_for_each(tt, tt_list_head) { - tt_info = list_entry(tt, struct xhci_tt_bw_info, tt_list); - if (tt_info->slot_id == slot_id) + list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) { + /* Multi-TT hubs will have more than one entry */ + if (tt_info->slot_id == slot_id) { + slot_found = true; + list_del(&tt_info->tt_list); + kfree(tt_info); + } else if (slot_found) { break; + } } - /* Cautionary measure in case the hub was disconnected before we - * stored the TT information. - */ - if (tt_info->slot_id != slot_id) - return; - - tt_next = tt->next; - tt_info = list_entry(tt, struct xhci_tt_bw_info, - tt_list); - /* Multi-TT hubs will have more than one entry */ - do { - list_del(tt); - kfree(tt_info); - tt = tt_next; - if (list_empty(tt_list_head)) - break; - tt_next = tt->next; - tt_info = list_entry(tt, struct xhci_tt_bw_info, - tt_list); - } while (tt_info->slot_id == slot_id); } int xhci_alloc_tt_info(struct xhci_hcd *xhci,