diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2018-12-30 13:17:52 +0300 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2019-04-18 11:18:53 +0300 |
commit | 444ac3844895c34ab71ffcec1b3199449d3434a4 (patch) | |
tree | 740d894bc76d652b3b763457dfbd28be9d2cc63a /drivers/thunderbolt/tb.c | |
parent | 44242d6c9703208e7e7abd6b4dbb258a930dd01a (diff) | |
download | linux-444ac3844895c34ab71ffcec1b3199449d3434a4.tar.xz |
thunderbolt: Make tb_switch_alloc() return ERR_PTR()
In order to detect possible connections to other domains we need to be
able to find out why tb_switch_alloc() fails so make it return ERR_PTR()
instead. This allows the caller to differentiate between errors such as
-ENOMEM which comes from the kernel and for instance -EIO which comes
from the hardware when trying to access the possible switch.
Convert all the current call sites to handle this properly.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-rw-r--r-- | drivers/thunderbolt/tb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c index 8a97a4e19638..c5e82c4dcb64 100644 --- a/drivers/thunderbolt/tb.c +++ b/drivers/thunderbolt/tb.c @@ -148,7 +148,7 @@ static void tb_scan_port(struct tb_port *port) } sw = tb_switch_alloc(port->sw->tb, &port->sw->dev, tb_downstream_route(port)); - if (!sw) + if (IS_ERR(sw)) return; if (tb_switch_configure(sw)) { @@ -533,8 +533,8 @@ static int tb_start(struct tb *tb) int ret; tb->root_switch = tb_switch_alloc(tb, &tb->dev, 0); - if (!tb->root_switch) - return -ENOMEM; + if (IS_ERR(tb->root_switch)) + return PTR_ERR(tb->root_switch); /* * ICM firmware upgrade needs running firmware and in native |