All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] drm/xe/psmi: Do not return NULL
Date: Tue, 23 Sep 2025 08:57:57 -0400	[thread overview]
Message-ID: <aNKZVSf0q0NgNPZF@intel.com> (raw)
In-Reply-To: <20250922221133.109921-2-lucas.demarchi@intel.com>

On Mon, Sep 22, 2025 at 03:11:34PM -0700, Lucas De Marchi wrote:
> The checks for id and bo_size are impossible conditions. If they were
> possible, then the caller should not be using IS_ERR(). Just replace
> them with asserts which should be compiled out when not debugging and
> at the same time prevent other refactors to break this assumption.
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/r/aK1nZjyAF0s7bnHg@stanley.mountain
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_psmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_psmi.c b/drivers/gpu/drm/xe/xe_psmi.c
> index 45d142191d600..6a54e38b81ba9 100644
> --- a/drivers/gpu/drm/xe/xe_psmi.c
> +++ b/drivers/gpu/drm/xe/xe_psmi.c
> @@ -70,8 +70,8 @@ static struct xe_bo *psmi_alloc_object(struct xe_device *xe,
>  {
>  	struct xe_tile *tile;
>  
> -	if (!id || !bo_size)
> -		return NULL;
> +	xe_assert(xe, id);
> +	xe_assert(xe, bo_size);
>  
>  	tile = &xe->tiles[id - 1];
>  
> -- 
> 2.50.1
> 

  parent reply	other threads:[~2025-09-23 12:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-22 22:11 [PATCH] drm/xe/psmi: Do not return NULL Lucas De Marchi
2025-09-22 22:18 ` ✓ CI.KUnit: success for " Patchwork
2025-09-22 23:16 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-23  5:03 ` ✓ Xe.CI.Full: " Patchwork
2025-09-23 12:57 ` Rodrigo Vivi [this message]
2025-09-23 17:24   ` [PATCH] " Lucas De Marchi

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=aNKZVSf0q0NgNPZF@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.