Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1629028 > unrolled thread

[PATCH 1/1] drm/radeon: check return vlaue of radeon_fence_emit

Started byPan Bian <bianpan201603@163.com>
First post2017-04-23 16:00 +0200
Last post2017-04-24 10:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] drm/radeon: check return vlaue of radeon_fence_emit Pan Bian <bianpan201603@163.com> - 2017-04-23 16:00 +0200
    Re: [PATCH 1/1] drm/radeon: check return vlaue of radeon_fence_emit Christian König <deathsimple@vodafone.de> - 2017-04-24 10:00 +0200

#1629028 — [PATCH 1/1] drm/radeon: check return vlaue of radeon_fence_emit

FromPan Bian <bianpan201603@163.com>
Date2017-04-23 16:00 +0200
Subject[PATCH 1/1] drm/radeon: check return vlaue of radeon_fence_emit
Message-ID<tzqdr-LO-3@gated-at.bofh.it>
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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
index 79181816..7a44703 100644
--- a/drivers/gpu/drm/radeon/radeon_test.c
+++ b/drivers/gpu/drm/radeon/radeon_test.c
@@ -298,7 +298,11 @@ 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) {
+			radeon_ring_unlock_undo(rdev, ring);
+			return r;
+		}
 		radeon_ring_unlock_commit(rdev, ring, false);
 	}
 	return 0;
-- 
1.9.1

[toc] | [next] | [standalone]


#1629277

FromChristian König <deathsimple@vodafone.de>
Date2017-04-24 10:00 +0200
Message-ID<tzH4C-4c8-3@gated-at.bofh.it>
In reply to#1629028
Am 23.04.2017 um 15:50 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>
> ---
>   drivers/gpu/drm/radeon/radeon_test.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
> index 79181816..7a44703 100644
> --- a/drivers/gpu/drm/radeon/radeon_test.c
> +++ b/drivers/gpu/drm/radeon/radeon_test.c
> @@ -298,7 +298,11 @@ 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) {
> +			radeon_ring_unlock_undo(rdev, ring);

Please add a DRM_ERROR() here as well.

Apart from that it looks good to me.

Christian.

> +			return r;
> +		}
>   		radeon_ring_unlock_commit(rdev, ring, false);
>   	}
>   	return 0;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web