From 359e83b45a6c3f8cfa131684acfb45459ba5a4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Thu, 3 Feb 2022 11:45:42 +0200 Subject: [PATCH] gpu: nvgpu: tsg: release default nvs domain ref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A reference to the default scheduling domain is taken when a TSG is opened. Although the explicit bind is designed to support only one bind, the TSG is bound to the default one implicitly at that point. Release the reference to avoid leaking it. The domain might be null at that point if the default domain has been removed; in that case there's just no domain to put back. Change-Id: I7db43f7bbb2a8c86c391280eb7fa32431c8982da Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2663420 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Alex Waterman GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/fifo/tsg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c index 2c16776dc..5392e3a2b 100644 --- a/drivers/gpu/nvgpu/common/fifo/tsg.c +++ b/drivers/gpu/nvgpu/common/fifo/tsg.c @@ -188,6 +188,11 @@ int nvgpu_tsg_bind_domain(struct nvgpu_tsg *tsg, u64 domain_id) return -ENOENT; } + /* Release the default domain ref that was implicitly taken at open */ + if (tsg->nvs_domain != NULL) { + nvgpu_nvs_domain_put(g, tsg->nvs_domain); + } + tsg->rl_domain = rl_domain; tsg->nvs_domain = nvs_domain;