summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/test.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2021-06-07 12:37:46 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2021-06-11 10:42:54 +0200
commita0d36fa1065901f939b04587a09c65303a64ac88 (patch)
tree71f56e2a42c62ca5ba3d34408a2139eec64092c3 /drivers/thunderbolt/test.c
parentthunderbolt: Check for NVM authentication status after the operation started (diff)
downloadlinux-a0d36fa1065901f939b04587a09c65303a64ac88.tar.xz
linux-a0d36fa1065901f939b04587a09c65303a64ac88.zip
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: 54509f5005ca ("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>
Diffstat (limited to 'drivers/thunderbolt/test.c')
-rw-r--r--drivers/thunderbolt/test.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/thunderbolt/test.c b/drivers/thunderbolt/test.c
index cf34c1ecf5d5..ba5afd471766 100644
--- a/drivers/thunderbolt/test.c
+++ b/drivers/thunderbolt/test.c
@@ -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;