Commit a0d36fa1 authored by Mika Westerberg's avatar Mika Westerberg
Browse files

thunderbolt: Bond lanes only when dual_link_port != NULL in alloc_dev_default()



We should not dereference ->dual_link_port if it is NULL and lane bonding
is requested. For this reason move lane bonding configuration happen
inside the block where ->dual_link_port != NULL.

Fixes: 54509f50 ("thunderbolt: Add KUnit tests for path walking")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarYehezkel Bernat <YehezkelShB@gmail.com>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 25335b30
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -303,7 +303,6 @@ static struct tb_switch *alloc_dev_default(struct kunit *test,
	if (port->dual_link_port && upstream_port->dual_link_port) {
		port->dual_link_port->remote = upstream_port->dual_link_port;
		upstream_port->dual_link_port->remote = port->dual_link_port;
	}

		if (bonded) {
			/* Bonding is used */
@@ -316,6 +315,7 @@ static struct tb_switch *alloc_dev_default(struct kunit *test,
			upstream_port->dual_link_port->bonded = true;
			upstream_port->dual_link_port->total_credits = 0;
		}
	}

	return sw;
}