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: 54509f5005
("thunderbolt: Add KUnit tests for path walking")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
25335b30da
commit
a0d36fa106
|
@ -303,18 +303,18 @@ 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 */
|
||||
port->bonded = true;
|
||||
port->total_credits *= 2;
|
||||
port->dual_link_port->bonded = true;
|
||||
port->dual_link_port->total_credits = 0;
|
||||
upstream_port->bonded = true;
|
||||
upstream_port->total_credits *= 2;
|
||||
upstream_port->dual_link_port->bonded = true;
|
||||
upstream_port->dual_link_port->total_credits = 0;
|
||||
if (bonded) {
|
||||
/* Bonding is used */
|
||||
port->bonded = true;
|
||||
port->total_credits *= 2;
|
||||
port->dual_link_port->bonded = true;
|
||||
port->dual_link_port->total_credits = 0;
|
||||
upstream_port->bonded = true;
|
||||
upstream_port->total_credits *= 2;
|
||||
upstream_port->dual_link_port->bonded = true;
|
||||
upstream_port->dual_link_port->total_credits = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return sw;
|
||||
|
|
Loading…
Reference in New Issue