drm/amdgpu: fix off by one in amdgpu_gfx_kiq_acquire()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 16 Mar 2022 08:41:48 +0000 (11:41 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 25 Mar 2022 16:40:24 +0000 (12:40 -0400)
This post-op should be a pre-op so that we do not pass -1 as the bit
number to test_bit().  The current code will loop downwards from 63 to
-1.  After changing to a pre-op, it loops from 63 to 0.

Fixes: 71c37505e7ea ("drm/amdgpu/gfx: move more common KIQ code to amdgpu_gfx.c")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c

index 8fe9399762242185c0d1e6a597beff027507ed6e..28a736c507bb3f84e956203d2c115b8afdc160de 100644 (file)
@@ -266,7 +266,7 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev,
                    * adev->gfx.mec.num_pipe_per_mec
                    * adev->gfx.mec.num_queue_per_pipe;
 
-       while (queue_bit-- >= 0) {
+       while (--queue_bit >= 0) {
                if (test_bit(queue_bit, adev->gfx.mec.queue_bitmap))
                        continue;