summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2025-09-08 13:31:29 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2026-05-05 13:53:46 +0200
commit8b4060998637f06975fceee9b73845d8672d411e (patch)
tree4e762a0320689dde9e108520151fa71a67686a2b
parentf5cc545f59699549adbaa4084149f8247865a51d (diff)
downloadlinux-8b4060998637f06975fceee9b73845d8672d411e.tar.gz
linux-8b4060998637f06975fceee9b73845d8672d411e.zip
thunderbolt: Keep XDomain reference during the lifetime of a service
This is needed because we release the service ID in tb_service_release() and the ID array is owned by the parent XDomain. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/thunderbolt/xdomain.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c
index a1887a15a284..0e97d0ad7733 100644
--- a/drivers/thunderbolt/xdomain.c
+++ b/drivers/thunderbolt/xdomain.c
@@ -1039,6 +1039,7 @@ static void tb_service_release(struct device *dev)
ida_free(&xd->service_ids, svc->id);
kfree(svc->key);
kfree(svc);
+ tb_xdomain_put(xd);
}
const struct device_type tb_service_type = {
@@ -1147,7 +1148,7 @@ static void enumerate_services(struct tb_xdomain *xd)
svc->id = id;
svc->dev.bus = &tb_bus_type;
svc->dev.type = &tb_service_type;
- svc->dev.parent = &xd->dev;
+ svc->dev.parent = get_device(&xd->dev);
dev_set_name(&svc->dev, "%s.%d", dev_name(&xd->dev), svc->id);
tb_service_debugfs_init(svc);