All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/psmi: Do not return NULL
@ 2025-09-22 22:11 Lucas De Marchi
  2025-09-22 22:18 ` ✓ CI.KUnit: success for " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Lucas De Marchi @ 2025-09-22 22:11 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi, Dan Carpenter

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>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-23 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] " Rodrigo Vivi
2025-09-23 17:24   ` Lucas De Marchi

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.