diff options
author | Jammy Zhou <Jammy.Zhou@amd.com> | 2015-05-12 11:17:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-06-03 21:03:35 -0400 |
commit | 4b095304ea7f73c178cd906df37185c0b9ad9a60 (patch) | |
tree | 7e1710f507e9896d75859d7dbd96de75fcd962ee /drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | |
parent | 02b70c8c9f0351f5ddf70716b9049f3fe50d62e7 (diff) |
drm/amdgpu: do necessary NULL check
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 7 |
1 files 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 855d56ac7115..21accbdd0a1a 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, | |||
101 | unsigned i; | 101 | unsigned i; |
102 | int r = 0; | 102 | int r = 0; |
103 | 103 | ||
104 | if (resv == NULL) | ||
105 | return -EINVAL; | ||
106 | |||
104 | /* always sync to the exclusive fence */ | 107 | /* always sync to the exclusive fence */ |
105 | f = reservation_object_get_excl(resv); | 108 | f = reservation_object_get_excl(resv); |
106 | fence = f ? to_amdgpu_fence(f) : NULL; | 109 | fence = f ? to_amdgpu_fence(f) : NULL; |
@@ -116,12 +119,12 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, | |||
116 | for (i = 0; i < flist->shared_count; ++i) { | 119 | for (i = 0; i < flist->shared_count; ++i) { |
117 | f = rcu_dereference_protected(flist->shared[i], | 120 | f = rcu_dereference_protected(flist->shared[i], |
118 | reservation_object_held(resv)); | 121 | reservation_object_held(resv)); |
119 | fence = to_amdgpu_fence(f); | 122 | fence = f ? to_amdgpu_fence(f) : NULL; |
120 | if (fence && fence->ring->adev == adev) { | 123 | if (fence && fence->ring->adev == adev) { |
121 | if (fence->owner != owner || | 124 | if (fence->owner != owner || |
122 | fence->owner == AMDGPU_FENCE_OWNER_UNDEFINED) | 125 | fence->owner == AMDGPU_FENCE_OWNER_UNDEFINED) |
123 | amdgpu_sync_fence(sync, fence); | 126 | amdgpu_sync_fence(sync, fence); |
124 | } else { | 127 | } else if (f) { |
125 | r = fence_wait(f, true); | 128 | r = fence_wait(f, true); |
126 | if (r) | 129 | if (r) |
127 | break; | 130 | break; |