diff options
author | Christian König <christian.koenig@amd.com> | 2015-05-11 08:32:17 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-06-03 21:03:33 -0400 |
commit | d919ad49ac04e1e417ea511d61455786a0f0fdb7 (patch) | |
tree | 89f8b02596095c3414c6d905f25848af0553a843 /drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |
parent | d2edb07b10fce5127a60671b55ca53921c212bc3 (diff) |
drm/amdgpu: fix dereference before check
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 6 |
1 files 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) | |||
138 | int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, | 138 | int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, |
139 | struct amdgpu_ib *ibs, void *owner) | 139 | struct amdgpu_ib *ibs, void *owner) |
140 | { | 140 | { |
141 | struct amdgpu_ring *ring; | ||
142 | struct amdgpu_vm *vm = ibs->vm; | ||
143 | struct amdgpu_ib *ib = &ibs[0]; | 141 | struct amdgpu_ib *ib = &ibs[0]; |
142 | struct amdgpu_ring *ring; | ||
143 | struct amdgpu_vm *vm; | ||
144 | unsigned i; | 144 | unsigned i; |
145 | int r = 0; | 145 | int r = 0; |
146 | 146 | ||
@@ -148,6 +148,8 @@ int amdgpu_ib_schedule(struct amdgpu_device *adev, unsigned num_ibs, | |||
148 | return -EINVAL; | 148 | return -EINVAL; |
149 | 149 | ||
150 | ring = ibs->ring; | 150 | ring = ibs->ring; |
151 | vm = ibs->vm; | ||
152 | |||
151 | if (!ring->ready) { | 153 | if (!ring->ready) { |
152 | dev_err(adev->dev, "couldn't schedule ib\n"); | 154 | dev_err(adev->dev, "couldn't schedule ib\n"); |
153 | return -EINVAL; | 155 | return -EINVAL; |