aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amdfalconx86/recipes-kernel/linux/files/0203-drm-amdgpu-do-necessary-NULL-check.patch
blob: 5807375602c07ffb05402349467cc9533675f895 (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
From 4b095304ea7f73c178cd906df37185c0b9ad9a60 Mon Sep 17 00:00:00 2001
From: Jammy Zhou <Jammy.Zhou@amd.com>
Date: Tue, 12 May 2015 23:17:19 +0800
Subject: [PATCH 0203/1050] drm/amdgpu: do necessary NULL check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index 855d56a..21accbd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -101,6 +101,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 	unsigned i;
 	int r = 0;
 
+	if (resv == NULL)
+		return -EINVAL;
+
 	/* always sync to the exclusive fence */
 	f = reservation_object_get_excl(resv);
 	fence = f ? to_amdgpu_fence(f) : NULL;
@@ -116,12 +119,12 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 	for (i = 0; i < flist->shared_count; ++i) {
 		f = rcu_dereference_protected(flist->shared[i],
 					      reservation_object_held(resv));
-		fence = to_amdgpu_fence(f);
+		fence = f ? to_amdgpu_fence(f) : NULL;
 		if (fence && fence->ring->adev == adev) {
 			if (fence->owner != owner ||
 			    fence->owner == AMDGPU_FENCE_OWNER_UNDEFINED)
 				amdgpu_sync_fence(sync, fence);
-		} else {
+		} else if (f) {
 			r = fence_wait(f, true);
 			if (r)
 				break;
-- 
1.9.1