[PATCH 64/88] drm/amdgpu: do necessary NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jammy Zhou <Jammy.Zhou@xxxxxxx>

Signed-off-by: Jammy Zhou <Jammy.Zhou@xxxxxxx>
Reviewed-by: Christian König <christian.koenig@xxxxxxx>
---
 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.8.3.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux