[ Smatch checking is paused while we raise funding. #SadFace
https://lore.kernel.org/all/[email protected]/ -dan ]
Hello Pierre-Eric Pelloux-Prayer,
Commit 30f2daedf4d8 ("drm/amdgpu: add missing lock in
amdgpu_benchmark_do_move") from Nov 18, 2025 (linux-next), leads to
the following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c:57
amdgpu_benchmark_do_move()
warn: inconsistent returns '&adev->mman.default_entity.lock'.
drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c
31 static int amdgpu_benchmark_do_move(struct amdgpu_device *adev, unsigned
size,
32 uint64_t saddr, uint64_t daddr, int
n, s64 *time_ms)
33 {
34 ktime_t stime, etime;
35 struct dma_fence *fence;
36 int i, r;
37
38 mutex_lock(&adev->mman.default_entity.lock);
39 stime = ktime_get();
40 for (i = 0; i < n; i++) {
41 r = amdgpu_copy_buffer(adev, &adev->mman.default_entity,
42 saddr, daddr, size, NULL, &fence,
43 false, 0);
44 if (r)
45 goto exit_do_move;
46 r = dma_fence_wait(fence, false);
47 dma_fence_put(fence);
48 if (r)
49 goto exit_do_move;
50 }
51 mutex_unlock(&adev->mman.default_entity.lock);
52
53 exit_do_move:
The unlock should be after the exit_do_move label.
54 etime = ktime_get();
55 *time_ms = ktime_ms_delta(etime, stime);
56
--> 57 return r;
58 }
regards,
dan carpenter