Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1045581AbdDWNwC (ORCPT ); Sun, 23 Apr 2017 09:52:02 -0400 Received: from m50-138.163.com ([123.125.50.138]:33241 "EHLO m50-138.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756138AbdDWNvx (ORCPT ); Sun, 23 Apr 2017 09:51:53 -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 vlaue of radeon_fence_emit Date: Sun, 23 Apr 2017 21:50:47 +0800 Message-Id: <1492955447-24386-1-git-send-email-bianpan201603@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: C9GowADncJQ4sfxYuHMyAA--.854S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZr4ftr43GrW5KF48WFy5CFg_yoWktFg_GF 18Xa97Ga97KrnYqFyxuFW3GryxKr4Fkr4rZF4Ig34ftry7Ar1kuFyrKF1DWr4UXa17JFnx Cw4vv3W2yrW7tjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeolk7UUUUU== X-Originating-IP: [123.118.194.153] X-CM-SenderInfo: held01tdqsiiqwqtqiywtou0bp/xtbBohrC91aDsTwRswAAs3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1138 Lines: 33 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 | 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