From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Currently there's a lot of silent error-return paths in various places
where nhi_probe() can fail. Sprinkle some prints to make it clearer
where the problem is.
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
drivers/thunderbolt/nhi.c | 4 ++--
drivers/thunderbolt/tb.c | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index ca832f802ee7..9f39a837c731 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -1184,7 +1184,7 @@ int nhi_probe_common(struct tb_nhi *nhi)
if (nhi->ops && nhi->ops->init) {
res = nhi->ops->init(nhi);
if (res)
- return res;
+ return dev_err_probe(dev, res, "NHI specific init failed\n");
}
tb = nhi_select_cm(nhi);
@@ -1202,7 +1202,7 @@ int nhi_probe_common(struct tb_nhi *nhi)
*/
tb_domain_put(tb);
nhi_shutdown(nhi);
- return res;
+ return dev_err_probe(dev, res, "tb_domain_add() failed\n");
}
dev_set_drvdata(dev, tb);
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 0126e38d9396..e743fb698b30 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -2990,7 +2990,8 @@ static int tb_start(struct tb *tb, bool reset)
tb->root_switch = tb_switch_alloc(tb, &tb->dev, 0);
if (IS_ERR(tb->root_switch))
- return PTR_ERR(tb->root_switch);
+ return dev_err_probe(tb->nhi->dev, PTR_ERR(tb->root_switch),
+ "tb_switch_alloc() failed\n");
/*
* ICM firmware upgrade needs running firmware and in native
@@ -3007,14 +3008,14 @@ static int tb_start(struct tb *tb, bool reset)
ret = tb_switch_configure(tb->root_switch);
if (ret) {
tb_switch_put(tb->root_switch);
- return ret;
+ return dev_err_probe(tb->nhi->dev, ret, "Couldn't configure switch\n");
}
/* Announce the switch to the world */
ret = tb_switch_add(tb->root_switch);
if (ret) {
tb_switch_put(tb->root_switch);
- return ret;
+ return dev_err_probe(tb->nhi->dev, ret, "Couldn't add switch\n");
}
/*
--
2.53.0
On Mon, Mar 09, 2026 at 11:33:01AM +0100, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
>
> Currently there's a lot of silent error-return paths in various places
> where nhi_probe() can fail. Sprinkle some prints to make it clearer
> where the problem is.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> drivers/thunderbolt/nhi.c | 4 ++--
> drivers/thunderbolt/tb.c | 7 ++++---
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
> index ca832f802ee7..9f39a837c731 100644
> --- a/drivers/thunderbolt/nhi.c
> +++ b/drivers/thunderbolt/nhi.c
> @@ -1184,7 +1184,7 @@ int nhi_probe_common(struct tb_nhi *nhi)
> if (nhi->ops && nhi->ops->init) {
> res = nhi->ops->init(nhi);
> if (res)
> - return res;
> + return dev_err_probe(dev, res, "NHI specific init failed\n");
> }
>
> tb = nhi_select_cm(nhi);
> @@ -1202,7 +1202,7 @@ int nhi_probe_common(struct tb_nhi *nhi)
> */
> tb_domain_put(tb);
> nhi_shutdown(nhi);
> - return res;
> + return dev_err_probe(dev, res, "tb_domain_add() failed\n");
That's "failed to add domain".
> }
> dev_set_drvdata(dev, tb);
>
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index 0126e38d9396..e743fb698b30 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -2990,7 +2990,8 @@ static int tb_start(struct tb *tb, bool reset)
>
> tb->root_switch = tb_switch_alloc(tb, &tb->dev, 0);
> if (IS_ERR(tb->root_switch))
> - return PTR_ERR(tb->root_switch);
> + return dev_err_probe(tb->nhi->dev, PTR_ERR(tb->root_switch),
> + "tb_switch_alloc() failed\n");
That's "failed to allocate host router".
>
> /*
> * ICM firmware upgrade needs running firmware and in native
> @@ -3007,14 +3008,14 @@ static int tb_start(struct tb *tb, bool reset)
> ret = tb_switch_configure(tb->root_switch);
> if (ret) {
> tb_switch_put(tb->root_switch);
> - return ret;
> + return dev_err_probe(tb->nhi->dev, ret, "Couldn't configure switch\n");
That's "failed to configure host router".
> }
>
> /* Announce the switch to the world */
> ret = tb_switch_add(tb->root_switch);
> if (ret) {
> tb_switch_put(tb->root_switch);
> - return ret;
> + return dev_err_probe(tb->nhi->dev, ret, "Couldn't add switch\n");
That's "failed to add host router".
> }
>
> /*
>
> --
> 2.53.0
© 2016 - 2026 Red Hat, Inc.