Hello Alex Deucher,
Commit 832f0aa050ff ("drm/amdgpu/gfx9.4.3: add support for disabling
kernel queues") from May 27, 2026 (linux-next), leads to the
following Smatch static checker warning:
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:2334
gfx_v9_4_3_set_userq_eop_interrupts()
warn: count down condition reversed? 'm <= 0'
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
2287 static int gfx_v9_4_3_set_userq_eop_interrupts(struct amdgpu_device
*adev,
2288 bool enable)
2289 {
2290 int num_xcc = NUM_XCC(adev->gfx.xcc_mask);
2291 unsigned int irq_type;
2292 int m, p, xcc_id, r;
2293
2294 if (adev->gfx.disable_kq) {
2295 for (xcc_id = 0; xcc_id < num_xcc; xcc_id++) {
2296 for (m = 0; m < adev->gfx.mec.num_mec; ++m) {
2297 for (p = 0; p <
adev->gfx.mec.num_pipe_per_mec; p++) {
2298 irq_type =
AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
2299 + (m *
adev->gfx.mec.num_pipe_per_mec)
2300 + p;
2301
2302 if (enable)
2303 r =
amdgpu_irq_get(adev, &adev->gfx.eop_irq,
2304
irq_type);
2305 else
2306 r =
amdgpu_irq_put(adev, &adev->gfx.eop_irq,
2307
irq_type);
2308 if (r) {
2309 if (!enable)
2310 return r;
2311 goto err_compute;
2312 }
2313 }
2314 }
2315 }
2316 }
2317
2318 return 0;
2319
2320 err_compute:
2321 for (p--; p >= 0; p--) {
2322 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
2323 + (m * adev->gfx.mec.num_pipe_per_mec) + p;
2324 amdgpu_irq_put(adev, &adev->gfx.eop_irq, irq_type);
2325 }
2326 for (m--; m >= 0; m--) {
2327 for (p = adev->gfx.mec.num_pipe_per_mec - 1; p >= 0;
p--) {
2328 irq_type = AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
2329 + (m * adev->gfx.mec.num_pipe_per_mec)
+ p;
2330 amdgpu_irq_put(adev, &adev->gfx.eop_irq,
irq_type);
2331 }
2332 }
2333 for (xcc_id--; xcc_id >= 0; xcc_id--) {
--> 2334 for (m = adev->gfx.mec.num_mec - 1; m <= 0; m--) {
^^^^^^
This should probably be m >= 0?
2335 for (p = adev->gfx.mec.num_pipe_per_mec - 1; p
>= 0; p--) {
2336 irq_type =
AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
2337 + (m *
adev->gfx.mec.num_pipe_per_mec) + p;
2338 amdgpu_irq_put(adev,
&adev->gfx.eop_irq, irq_type);
2339 }
2340 }
2341 }
2342
2343 return r;
2344 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter