All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/amdgpu: add missing lock in amdgpu_benchmark_do_move
@ 2026-02-27  7:55 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-02-27  7:55 UTC (permalink / raw)
  To: Pierre-Eric Pelloux-Prayer; +Cc: amd-gfx, dri-devel, SHANMUGAM, SRINIVASAN

[ Smatch checking is paused while we raise funding. #SadFace
  https://lore.kernel.org/all/aTaiGSbWZ9DJaGo7@stanley.mountain/ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-27  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27  7:55 [bug report] drm/amdgpu: add missing lock in amdgpu_benchmark_do_move Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.