[PATCH v2 4/6] drm: remove dead WARN_ON NULL check after GFP_NOFAIL allocation
From: Gou Hao
Date: Thu Jul 23 2026 - 22:30:13 EST
kzalloc_obj with the __GFP_NOFAIL flag will never return NULL, so the
subsequent WARN_ON(!ctx) is unreachable dead code. Remove it.
Signed-off-by: Gou Hao <gouhao@xxxxxxxxxxxxx>
---
drivers/gpu/drm/drm_modeset_lock.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
index 2c806b0146d67..e14814c30d8c0 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -149,11 +149,7 @@ void drm_modeset_lock_all(struct drm_device *dev)
int ret;
ctx = kzalloc_obj(*ctx, GFP_KERNEL | __GFP_NOFAIL);
- if (WARN_ON(!ctx))
- return;
-
mutex_lock(&config->mutex);
-
drm_modeset_acquire_init(ctx, 0);
retry:
--
2.20.1