--- a/drivers/thunderbolt/domain.c 2026-06-23 07:35:46.060061342 -0400 +++ b/drivers/thunderbolt/domain.c 2026-07-11 15:09:12.748107785 -0400 @@ -321,13 +321,19 @@ static void tb_domain_release(struct dev struct tb *tb = container_of(dev, struct tb, dev); struct tb_nhi *nhi = tb->nhi; - tb_ctl_free(tb->ctl); - destroy_workqueue(tb->wq); + if (tb->ctl) + tb_ctl_free(tb->ctl); + + if (tb->wq) + destroy_workqueue(tb->wq); + ida_free(&tb_domain_ida, tb->index); + + if (tb->cm_ops && tb->cm_ops->complete) + complete(&nhi->domain_released); + mutex_destroy(&tb->lock); kfree(tb); - - complete(&nhi->domain_released); } const struct device_type tb_domain_type = { @@ -405,6 +411,8 @@ struct tb *tb_domain_alloc(struct tb_nhi if (!tb->ctl) goto err_destroy_wq; + tb->cm_ops = NULL; + tb->dev.parent = nhi->dev; tb->dev.bus = &tb_bus_type; tb->dev.type = &tb_domain_type; @@ -600,7 +608,7 @@ int tb_domain_thaw_noirq(struct tb *tb) void tb_domain_complete(struct tb *tb) { - if (tb->cm_ops->complete) + if (tb && tb->cm_ops && tb->cm_ops->complete) tb->cm_ops->complete(tb); }