summaryrefslogtreecommitdiffstats
path: root/drivers/accel
diff options
context:
space:
mode:
authorKoby Elbaz <kelbaz@habana.ai>2023-06-06 11:57:51 +0300
committerOded Gabbay <ogabbay@kernel.org>2023-10-09 12:37:18 +0300
commit942f18c56d2106115bcf344cc7b0f762c6fc55c2 (patch)
tree0399f82ca0e3de6e9f3d507348379ed65e4a524e /drivers/accel
parent2b541cf91373b1bc1634a82b668022d50c05603c (diff)
downloadlinux-942f18c56d2106115bcf344cc7b0f762c6fc55c2.tar.gz
linux-942f18c56d2106115bcf344cc7b0f762c6fc55c2.tar.bz2
linux-942f18c56d2106115bcf344cc7b0f762c6fc55c2.zip
accel/habanalabs: call put_pid after hpriv list is updated
Because we might still be using related resources, decrementing PID's reference count should be done at later stages of the device release. A good place is right after the representing private structure is removed from LKD's list. Signed-off-by: Koby Elbaz <kelbaz@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/accel')
-rw-r--r--drivers/accel/habanalabs/common/device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/accel/habanalabs/common/device.c b/drivers/accel/habanalabs/common/device.c
index 764d40c0d666..c61a58a2e622 100644
--- a/drivers/accel/habanalabs/common/device.c
+++ b/drivers/accel/habanalabs/common/device.c
@@ -408,8 +408,6 @@ static void hpriv_release(struct kref *ref)
hdev->asic_funcs->send_device_activity(hdev, false);
- put_pid(hpriv->taskpid);
-
hl_debugfs_remove_file(hpriv);
mutex_destroy(&hpriv->ctx_lock);
@@ -448,6 +446,8 @@ static void hpriv_release(struct kref *ref)
list_del(&hpriv->dev_node);
mutex_unlock(&hdev->fpriv_list_lock);
+ put_pid(hpriv->taskpid);
+
if (reset_device) {
hl_device_reset(hdev, HL_DRV_RESET_DEV_RELEASE);
} else {