aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/5667-drm-amdkfd-Fix-error-handling-around-kfd_process_cre.patch
blob: f0cadd3a1efe17372d911935340ff4352d097204 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From f8a6cd4103937c915212ef74e85167d09b3c513c Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Tue, 24 Apr 2018 18:26:51 -0400
Subject: [PATCH 5667/5725] drm/amdkfd: Fix error handling around
 kfd_process_create_wq

Change-Id: Ic4c2b210db0cd248e82916f7f4b04b6c2071ed69
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_module.c  | 5 +++--
 drivers/gpu/drm/amd/amdkfd/kfd_process.c | 7 ++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
index a05f734..261657f 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
@@ -102,7 +102,6 @@ MODULE_PARM_DESC(halt_if_hws_hang, "Halt if HWS hang is detected (0 = off (defau
 
 static int amdkfd_init_completed;
 
-
 int kgd2kfd_init(unsigned int interface_version,
 		const struct kgd2kfd_calls **g2f)
 {
@@ -155,7 +154,7 @@ static int __init kfd_module_init(void)
 
 	err = kfd_ipc_init();
 	if (err < 0)
-		goto err_topology;
+		goto err_ipc;
 
 	err = kfd_process_create_wq();
 	if (err < 0)
@@ -172,6 +171,8 @@ static int __init kfd_module_init(void)
 	return 0;
 
 err_create_wq:
+err_ipc:
+	kfd_topology_shutdown();
 err_topology:
 	kfd_chardev_exit();
 err_ioctl:
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 7459d39..4f2f285 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -80,7 +80,12 @@ int kfd_process_create_wq(void)
 	if (!kfd_restore_wq)
 		kfd_restore_wq = alloc_ordered_workqueue("kfd_restore_wq", 0);
 
-	return kfd_process_wq && kfd_restore_wq ? 0 : -ENOMEM;
+	if (!kfd_process_wq || !kfd_restore_wq) {
+		kfd_process_destroy_wq();
+		return -ENOMEM;
+	}
+
+	return 0;
 }
 
 void kfd_process_destroy_wq(void)
-- 
2.7.4