Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Wang, X" <x.wang@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH] drm/xe/madvise: Remove unreachable madvise_funcs NULL check
Date: Thu, 24 Sep 2026 11:30:48 -0700	[thread overview]
Message-ID: <dcb7229c-74ac-428c-a8f9-10dcd8efe3fb@intel.com> (raw)
In-Reply-To: <20260915011229.203424-1-shuicheng.lin@intel.com>



On 9/14/2026 18:12, Shuicheng Lin wrote:
> 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
The code change looks good to me. One small commit-message nit:
Documentation/process/coding-assistants.rst specifies the format
"Assisted-by: AGENT_NAME:MODEL_VERSION". Could you replace
"Assisted-by: LLM" with the tool and model version used? If it was
the same as v1, you could restore its Assisted-by tag.

Reviewed-by: Xin Wang <x.wang@intel.com>
> Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
> ---
> Cc: Arvind Yadav <arvind.yadav@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
>   drivers/gpu/drm/xe/xe_vm_madvise.c | 6 ------
>   1 file changed, 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);
>   


  parent reply	other threads:[~2026-09-24 18:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  1:12 [PATCH] drm/xe/madvise: Remove unreachable madvise_funcs NULL check Shuicheng Lin
2026-09-15  1:20 ` ✓ CI.KUnit: success for drm/xe/madvise: Remove unreachable madvise_funcs NULL check (rev2) Patchwork
2026-09-15  6:13 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-25 15:43   ` Lin, Shuicheng
2026-09-24 18:30 ` Wang, X [this message]
2026-09-24 20:44   ` [PATCH] drm/xe/madvise: Remove unreachable madvise_funcs NULL check Lin, Shuicheng
2026-09-24 22:26     ` Wang, X
  -- strict thread matches above, loose matches on Subject: below --
2026-07-08 18:09 Shuicheng Lin

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=dcb7229c-74ac-428c-a8f9-10dcd8efe3fb@intel.com \
    --to=x.wang@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /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