Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1045571AbdDWNh3 (ORCPT ); Sun, 23 Apr 2017 09:37:29 -0400 Received: from m50-133.163.com ([123.125.50.133]:33842 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752923AbdDWNhX (ORCPT ); Sun, 23 Apr 2017 09:37:23 -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_ring_lock Date: Sun, 23 Apr 2017 21:36:43 +0800 Message-Id: <1492954603-16489-1-git-send-email-bianpan201603@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DdGowAA35m3rrfxYSOMrAA--.876S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7CFW7tw1xJry7Kw1rJw48Xrb_yoW8XFWrpr ZY9FWqyrZa9ayjv343CrW3A3W5Aw48XayxWryUGw1S9r15AF47tr97GryUKry8ArZxu3W7 trs0g3yfZw10yaUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jXMa8UUUUU= X-Originating-IP: [123.118.194.153] X-CM-SenderInfo: held01tdqsiiqwqtqiywtou0bp/1tbiuA-C91QG8nZwlQABsw Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1458 Lines: 39 From: Pan Bian Function radeon_ring_lock() returns an errno on failure, and its return value should be validated. However, in functions r420_cp_errata_init() and r420_cp_errata_fini(), its return value is not checked. This patch adds the checks. Signed-off-by: Pan Bian --- drivers/gpu/drm/radeon/r420.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index 2828605..a8c2b37 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c @@ -215,7 +215,8 @@ static void r420_cp_errata_init(struct radeon_device *rdev) * of the CP init, apparently. */ radeon_scratch_get(rdev, &rdev->config.r300.resync_scratch); - radeon_ring_lock(rdev, ring, 8); + if (radeon_ring_lock(rdev, ring, 8)) + return; radeon_ring_write(ring, PACKET0(R300_CP_RESYNC_ADDR, 1)); radeon_ring_write(ring, rdev->config.r300.resync_scratch); radeon_ring_write(ring, 0xDEADBEEF); @@ -229,7 +230,8 @@ static void r420_cp_errata_fini(struct radeon_device *rdev) /* Catch the RESYNC we dispatched all the way back, * at the very beginning of the CP init. */ - radeon_ring_lock(rdev, ring, 8); + if (radeon_ring_lock(rdev, ring, 8)) + return; radeon_ring_write(ring, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); radeon_ring_write(ring, R300_RB3D_DC_FINISH); radeon_ring_unlock_commit(rdev, ring, false); -- 1.9.1