From: Dan Carpenter <dan.carpenter@linaro.org>
To: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
"SHANMUGAM, SRINIVASAN" <SRINIVASAN.SHANMUGAM@amd.com>
Subject: [bug report] drm/amdgpu: add missing lock in amdgpu_benchmark_do_move
Date: Fri, 27 Feb 2026 10:55:04 +0300 [thread overview]
Message-ID: <aaFN2JyOolrjynKP@stanley.mountain> (raw)
[ 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
reply other threads:[~2026-02-27 9:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aaFN2JyOolrjynKP@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=SRINIVASAN.SHANMUGAM@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=pierre-eric.pelloux-prayer@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox