If a PCIe downstream adapter is marked disabled in the DROM, that port
is ineligible for tunnel establishment, so skip over it when searching
for an unused port.

Signed-off-by: Lukas Wunner <lu...@wunner.de>
---
 drivers/thunderbolt/tb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 1424581fd9af..0da2e7a06ab5 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -147,6 +147,8 @@ static struct tb_port *tb_find_unused_down_port(struct 
tb_switch *sw)
        int res;
        int data;
        for (i = 1; i <= sw->config.max_port_number; i++) {
+               if (sw->ports[i].disabled)
+                       continue;
                if (tb_is_upstream_port(&sw->ports[i]))
                        continue;
                if (sw->ports[i].config.type != TB_TYPE_PCIE_DOWN)
-- 
2.18.0

Reply via email to