From ebaf75adbec33356d746ca7df36b72d31e7e5109 Mon Sep 17 00:00:00 2001 From: Gou Hao Date: Fri, 24 Jul 2026 10:28:49 +0800 Subject: [PATCH] drm: remove dead WARN_ON NULL check after GFP_NOFAIL allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kzalloc_obj with the __GFP_NOFAIL flag will never return NULL, so the subsequent WARN_ON(!ctx) is unreachable dead code. Remove it. Link: https://lore.kernel.org/20260724022851.466017-5-gouhao@uniontech.com Signed-off-by: Gou Hao Cc: Bharat Potnuri Cc: Cédric Le Goater Cc: Dave Airlie Cc: Jason Gunthorpe Cc: jiazhenyuan Cc: Leon Romanovsky Cc: Maarten Lankhorst Cc: Madhavan Srinivasan Cc: Maxime Ripard Cc: Michael Ellerman Cc: Nam Cao Cc: Nicholas Piggin Cc: Nilay Shroff Cc: Shrikanth Hegde Cc: Thomas Zimemrmann Cc: Wentao Guan Cc: Alistair Popple Signed-off-by: Andrew Morton --- 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 2c806b0146d6..e14814c30d8c 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: