From 956fc9cc056abc878256298e05745fc76732c82c Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 19 Feb 2019 23:29:20 -0800 Subject: usb: xhci-hcd: Simplify route string building loop Simplify route string building loop by avoiding checking top_dev->parent->descriptor->bDeviceClass twice. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- drivers/usb/host/xhci-hcd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/host/xhci-hcd.c b/drivers/usb/host/xhci-hcd.c index 5174463793..32a6ccd5cd 100644 --- a/drivers/usb/host/xhci-hcd.c +++ b/drivers/usb/host/xhci-hcd.c @@ -947,10 +947,12 @@ static int xhci_virtdev_init(struct xhci_virtual_device *vdev) */ for (top_dev = vdev->udev; top_dev->parent && top_dev->parent->parent; top_dev = top_dev->parent) { - if (top_dev->parent->descriptor->bDeviceClass == USB_CLASS_HUB) - route = (route << 4) | (top_dev->portnr & 0xf); - if (top_dev->parent->descriptor->bDeviceClass == USB_CLASS_HUB && - top_dev->parent->speed != USB_SPEED_LOW && + if (top_dev->parent->descriptor->bDeviceClass != USB_CLASS_HUB) + continue; + + route = (route << 4) | (top_dev->portnr & 0xf); + + if (top_dev->parent->speed != USB_SPEED_LOW && top_dev->parent->speed != USB_SPEED_FULL) { on_hs_hub = true; if (!hs_slot_id) { -- cgit v1.2.3