]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 13:19:54 +0000 (15:19 +0200)
BugLink: https://bugs.launchpad.net/bugs/1971497
[ Upstream commit 1647b54ed55d4d48c7199d439f8834626576cbe9 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c

index f9bef3154b99833eff9a5f595c39a9a269176a79..2659202f2026b2f98eb4023c52183b30dd55fcd7 100644 (file)
@@ -263,7 +263,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;