mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/radeon: check return value of radeon_fence_emit
@ 2017-04-24  8:45 Pan Bian
  2017-04-24  9:08 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2017-04-24  8:45 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David Airlie
  Cc: amd-gfx, dri-devel, linux-kernel, Pan Bian

From: Pan Bian <bianpan2016@163.com>

Function radeon_fence_emit() returns -ENOMEM if there is no enough
memory. And in this case, function radeon_ring_unlock_undo() rather than
function radeon_ring_unlock_commit() should be called. However, in
function radeon_test_create_and_emit_fence(), the return value of
radeon_fence_emit() is ignored. This patch adds the check.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/gpu/drm/radeon/radeon_test.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
index 79181816..623768e 100644
--- a/drivers/gpu/drm/radeon/radeon_test.c
+++ b/drivers/gpu/drm/radeon/radeon_test.c
@@ -298,7 +298,12 @@ static int radeon_test_create_and_emit_fence(struct radeon_device *rdev,
 			DRM_ERROR("Failed to lock ring A %d\n", ring->idx);
 			return r;
 		}
-		radeon_fence_emit(rdev, fence, ring->idx);
+		r = radeon_fence_emit(rdev, fence, ring->idx);
+		if (r) {
+			DRM_ERROR("Failed to emit fence\n");
+			radeon_ring_unlock_undo(rdev, ring);
+			return r;
+		}
 		radeon_ring_unlock_commit(rdev, ring, false);
 	}
 	return 0;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] drm/radeon: check return value of radeon_fence_emit
  2017-04-24  8:45 [PATCH 1/1] drm/radeon: check return value of radeon_fence_emit Pan Bian
@ 2017-04-24  9:08 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2017-04-24  9:08 UTC (permalink / raw)
  To: Pan Bian, Alex Deucher, David Airlie
  Cc: amd-gfx, dri-devel, linux-kernel, Pan Bian

Am 24.04.2017 um 10:45 schrieb Pan Bian:
> From: Pan Bian <bianpan2016@163.com>
>
> Function radeon_fence_emit() returns -ENOMEM if there is no enough
> memory. And in this case, function radeon_ring_unlock_undo() rather than
> function radeon_ring_unlock_commit() should be called. However, in
> function radeon_test_create_and_emit_fence(), the return value of
> radeon_fence_emit() is ignored. This patch adds the check.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/radeon/radeon_test.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
> index 79181816..623768e 100644
> --- a/drivers/gpu/drm/radeon/radeon_test.c
> +++ b/drivers/gpu/drm/radeon/radeon_test.c
> @@ -298,7 +298,12 @@ static int radeon_test_create_and_emit_fence(struct radeon_device *rdev,
>   			DRM_ERROR("Failed to lock ring A %d\n", ring->idx);
>   			return r;
>   		}
> -		radeon_fence_emit(rdev, fence, ring->idx);
> +		r = radeon_fence_emit(rdev, fence, ring->idx);
> +		if (r) {
> +			DRM_ERROR("Failed to emit fence\n");
> +			radeon_ring_unlock_undo(rdev, ring);
> +			return r;
> +		}
>   		radeon_ring_unlock_commit(rdev, ring, false);
>   	}
>   	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-24  9:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-24  8:45 [PATCH 1/1] drm/radeon: check return value of radeon_fence_emit Pan Bian
2017-04-24  9:08 ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®