]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: replace WARN with DRM_ERROR for invalid sched priority
authorJesse.Zhang <Jesse.Zhang@amd.com>
Fri, 13 Mar 2026 06:17:10 +0000 (14:17 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Mar 2026 18:02:04 +0000 (14:02 -0400)
amdgpu_sched_ioctl() currently uses WARN(1, ...) when userspace passes
an out-of-range context priority value. WARN(1, ...) is unconditional
and produces a full stack trace, which is disproportionate for a simple
input validation failure -- the invalid value is already rejected with
-EINVAL on the next line.

Replace WARN(1, ...) with DRM_ERROR() to log the invalid value at an
appropriate level without generating a stack dump. The -EINVAL return
to userspace is unchanged.

No functional change for well-formed userspace callers.

v2:
- Reworked commit message to focus on appropriate log level for
  parameter validation
- Clarified that -EINVAL behavior is preserved (Vitaly)

v3: completely drop that warning.
   Invalid parameters should never clutter the system log. (Christian)

Reviewed-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c

index 341beec595375ccdc3c8d26e5b447ad5d152da17..0eecfaa3a94c1b54a406c7f51bb90db38520525e 100644 (file)
@@ -103,10 +103,8 @@ int amdgpu_sched_ioctl(struct drm_device *dev, void *data,
                return -EINVAL;
        }
 
-       if (!amdgpu_ctx_priority_is_valid(args->in.priority)) {
-               WARN(1, "Invalid context priority %d\n", args->in.priority);
+       if (!amdgpu_ctx_priority_is_valid(args->in.priority))
                return -EINVAL;
-       }
 
        switch (args->in.op) {
        case AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE: