From d919ad49ac04e1e417ea511d61455786a0f0fdb7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20K=C3=B6nig?= Date: Mon, 11 May 2015 14:32:17 +0200 Subject: [PATCH] drm/amdgpu: fix dereference before check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König Reviewed-by: Alex Deucher Reviewed-by: Jammy Zhou Reviewed-by: Monk Liu --- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 66c66f83b407..74ed94ee7102 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c @@ -138,9 +138,9 @@ void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib) int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, struct amdgpu_ib *ibs, void *owner) { - struct amdgpu_ring *ring; - struct amdgpu_vm *vm = ibs->vm; struct amdgpu_ib *ib = &ibs[0]; + struct amdgpu_ring *ring; + struct amdgpu_vm *vm; unsigned i; int r = 0; @@ -148,6 +148,8 @@ int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, return -EINVAL; ring = ibs->ring; + vm = ibs->vm; + if (!ring->ready) { dev_err(adev->dev, "couldn't schedule ib\n"); return -EINVAL; -- 2.20.1