drm/amdgpu: do necessary NULL check
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
parent
02b70c8c9f
commit
4b095304ea
1 changed files with 5 additions and 2 deletions
|
@ -101,6 +101,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
|
if (resv == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* always sync to the exclusive fence */
|
/* always sync to the exclusive fence */
|
||||||
f = reservation_object_get_excl(resv);
|
f = reservation_object_get_excl(resv);
|
||||||
fence = f ? to_amdgpu_fence(f) : NULL;
|
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) {
|
for (i = 0; i < flist->shared_count; ++i) {
|
||||||
f = rcu_dereference_protected(flist->shared[i],
|
f = rcu_dereference_protected(flist->shared[i],
|
||||||
reservation_object_held(resv));
|
reservation_object_held(resv));
|
||||||
fence = to_amdgpu_fence(f);
|
fence = f ? to_amdgpu_fence(f) : NULL;
|
||||||
if (fence && fence->ring->adev == adev) {
|
if (fence && fence->ring->adev == adev) {
|
||||||
if (fence->owner != owner ||
|
if (fence->owner != owner ||
|
||||||
fence->owner == AMDGPU_FENCE_OWNER_UNDEFINED)
|
fence->owner == AMDGPU_FENCE_OWNER_UNDEFINED)
|
||||||
amdgpu_sync_fence(sync, fence);
|
amdgpu_sync_fence(sync, fence);
|
||||||
} else {
|
} else if (f) {
|
||||||
r = fence_wait(f, true);
|
r = fence_wait(f, true);
|
||||||
if (r)
|
if (r)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue