Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c346fb74 authored by Pan Bian's avatar Pan Bian Committed by Alex Deucher
Browse files

drm/radeon: check return value of radeon_ring_lock



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.

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 91faed9e
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -203,6 +203,7 @@ static void r420_clock_resume(struct radeon_device *rdev)


static void r420_cp_errata_init(struct radeon_device *rdev)
static void r420_cp_errata_init(struct radeon_device *rdev)
{
{
	int r;
	struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
	struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];


	/* RV410 and R420 can lock up if CP DMA to host memory happens
	/* RV410 and R420 can lock up if CP DMA to host memory happens
@@ -212,7 +213,8 @@ static void r420_cp_errata_init(struct radeon_device *rdev)
	 * of the CP init, apparently.
	 * of the CP init, apparently.
	 */
	 */
	radeon_scratch_get(rdev, &rdev->config.r300.resync_scratch);
	radeon_scratch_get(rdev, &rdev->config.r300.resync_scratch);
	radeon_ring_lock(rdev, ring, 8);
	r = radeon_ring_lock(rdev, ring, 8);
	WARN_ON(r);
	radeon_ring_write(ring, PACKET0(R300_CP_RESYNC_ADDR, 1));
	radeon_ring_write(ring, PACKET0(R300_CP_RESYNC_ADDR, 1));
	radeon_ring_write(ring, rdev->config.r300.resync_scratch);
	radeon_ring_write(ring, rdev->config.r300.resync_scratch);
	radeon_ring_write(ring, 0xDEADBEEF);
	radeon_ring_write(ring, 0xDEADBEEF);
@@ -221,12 +223,14 @@ static void r420_cp_errata_init(struct radeon_device *rdev)


static void r420_cp_errata_fini(struct radeon_device *rdev)
static void r420_cp_errata_fini(struct radeon_device *rdev)
{
{
	int r;
	struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
	struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];


	/* Catch the RESYNC we dispatched all the way back,
	/* Catch the RESYNC we dispatched all the way back,
	 * at the very beginning of the CP init.
	 * at the very beginning of the CP init.
	 */
	 */
	radeon_ring_lock(rdev, ring, 8);
	r = radeon_ring_lock(rdev, ring, 8);
	WARN_ON(r);
	radeon_ring_write(ring, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
	radeon_ring_write(ring, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0));
	radeon_ring_write(ring, R300_RB3D_DC_FINISH);
	radeon_ring_write(ring, R300_RB3D_DC_FINISH);
	radeon_ring_unlock_commit(rdev, ring, false);
	radeon_ring_unlock_commit(rdev, ring, false);