Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1166357AbdDXIqg (ORCPT ); Mon, 24 Apr 2017 04:46:36 -0400 Received: from m12-17.163.com ([220.181.12.17]:59162 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1166253AbdDXIq2 (ORCPT ); Mon, 24 Apr 2017 04:46:28 -0400 From: Pan Bian To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] drm/radeon: check return value of radeon_fence_emit Date: Mon, 24 Apr 2017 16:45:51 +0800 Message-Id: <1493023551-12003-1-git-send-email-bianpan201603@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: EcCowABHP24_u_1YBI4JAg--.32671S3 X-Coremail-Antispam: 1Uf129KBjvJXoWrZr4ftr43GrW5KF48WFy5CFg_yoW8Jry8pr 47Gr9akrsIkw4jg343CFWxZr45Cw48Wa18WFyxC398uw15AF1UKFy3Gw47trW8Jr92yr12 yF4DKa4UA3WFywUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bOdb8UUUUU= X-Originating-IP: [106.120.213.67] X-CM-SenderInfo: held01tdqsiiqwqtqiywtou0bp/xtbBogHD91aDsUVieQAAst Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1180 Lines: 34 From: Pan Bian 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 --- 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