diff options
| author | Shuicheng Lin <shuicheng.lin@intel.com> | 2026-09-15 01:12:29 +0000 |
|---|---|---|
| committer | Shuicheng Lin <shuicheng.lin@intel.com> | 2026-09-25 08:34:16 -0700 |
| commit | 5f058063197cd9db5ea73807223ea0df28ebfb82 (patch) | |
| tree | 842c2fcef226d0a67c03ecad3c0ae2a7829d3732 /drivers/gpu | |
| parent | 923bab365da28fdae995d08e67fbc2aa3eff1c6c (diff) | |
| download | linux-next-5f058063197cd9db5ea73807223ea0df28ebfb82.tar.gz linux-next-5f058063197cd9db5ea73807223ea0df28ebfb82.zip | |
drm/xe/madvise: Remove unreachable madvise_funcs NULL check
The NULL check on madvise_funcs[attr_type] in xe_vm_madvise_ioctl()
is unreachable. madvise_args_are_sane() already validates args->type
via a switch statement whose default case rejects any type not present
in madvise_funcs[]. Every type that passes the sanity check has a
corresponding entry in the table.
Beyond being dead code, the check's error path (goto err_fini) would
also skip xe_svm_notifier_unlock() if it were somehow reached with
has_svm_userptr_vmas set, since err_fini only tears down the drm_exec.
Removing the check eliminates both the redundancy and the latent
unwind hazard.
No functional change.
Assisted-by: LLM
Reviewed-by: Xin Wang <x.wang@intel.com>
Link: https://patch.msgid.link/20260915011229.203424-1-shuicheng.lin@intel.com
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/xe/xe_vm_madvise.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm_madvise.c b/drivers/gpu/drm/xe/xe_vm_madvise.c index 0474768a38aa..5c7aefc641ee 100644 --- a/drivers/gpu/drm/xe/xe_vm_madvise.c +++ b/drivers/gpu/drm/xe/xe_vm_madvise.c @@ -713,12 +713,6 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil attr_type = array_index_nospec(args->type, ARRAY_SIZE(madvise_funcs)); - /* Ensure the madvise function exists for this type */ - if (!madvise_funcs[attr_type]) { - err = -EINVAL; - goto err_fini; - } - madvise_funcs[attr_type](xe, vm, madvise_range.vmas, madvise_range.num_vmas, args, &details); |
