]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amdkfd: fix loop error handling
authorTom Rix <trix@redhat.com>
Thu, 10 Feb 2022 17:04:18 +0000 (09:04 -0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 11 Feb 2022 21:11:33 +0000 (16:11 -0500)
commitb4126d47e790ae3f6c2d7ea21747e761410bef17
treea3ccb358c2daeb006fd5af6196c2f63646c765db
parent1ac9f4d4b920c3ddd4d5cebb3d3a2cb2696683c3
drm/amdkfd: fix loop error handling

Clang static analysis reports this problem
kfd_chardev.c:2594:16: warning: The expression is an uninitialized value.
  The computed value will also be garbage
        while (ret && i--) {
                      ^~~

i is a loop variable and this block unwinds a problem in the loop.
When the error happens before the loop, this value is garbage.
Move the initialization of i to its decalaration.

Fixes: 7ff0cf4b461e ("drm/amdkfd: CRIU export BOs as prime dmabuf objects")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c