]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thunderbolt: Add some more descriptive probe error messages
authorKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Thu, 21 May 2026 10:40:03 +0000 (12:40 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 21 May 2026 12:29:05 +0000 (14:29 +0200)
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>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/nhi.c
drivers/thunderbolt/tb.c

index e9ba8ffbe349e197fdc83c74f1619363f970d033..0f795ea58756d6d3c73bb22f2d427e218e6e1ac8 100644 (file)
@@ -1223,7 +1223,7 @@ int nhi_probe(struct tb_nhi *nhi)
        if (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);
@@ -1244,7 +1244,7 @@ int nhi_probe(struct tb_nhi *nhi)
                tb_domain_put(tb);
                wait_for_completion(&nhi->domain_released);
                nhi_shutdown(nhi);
-               return res;
+               return dev_err_probe(dev, res, "failed to add domain\n");
        }
        dev_set_drvdata(dev, tb);
 
index d60c0b8eb3908e9ad88da366ef8d3297f51be806..76323255439a88ffecf78e59e467f8e1de124e3e 100644 (file)
@@ -3000,7 +3000,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),
+                                    "failed to allocate host router\n");
 
        /*
         * ICM firmware upgrade needs running firmware and in native
@@ -3017,14 +3018,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, "failed to configure host router\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, "failed to add host router\n");
        }
 
        /*