From f14bd29bbb1ad121cbf22939dbff6e42ef6f4b90 Mon Sep 17 00:00:00 2001 From: Gou Hao Date: Fri, 24 Jul 2026 10:28:50 +0800 Subject: [PATCH] lib/test_hmm: remove dead NULL checks after GFP_NOFAIL allocations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kvcalloc with the __GFP_NOFAIL flag will never return NULL, so the subsequent NULL checks are unreachable dead code. Remove them. Link: https://lore.kernel.org/20260724022851.466017-6-gouhao@uniontech.com Signed-off-by: Gou Hao Reviewed-by: Alistair Popple 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 Signed-off-by: Andrew Morton --- lib/test_hmm.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index c4adbf98fac7..be1fbc33ba3f 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -1209,16 +1209,10 @@ static int dmirror_migrate_to_device(struct dmirror *dmirror, if (!mmget_not_zero(mm)) return -EINVAL; - ret = -ENOMEM; src_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*src_pfns), GFP_KERNEL | __GFP_NOFAIL); - if (!src_pfns) - goto free_mem; - dst_pfns = kvcalloc(PTRS_PER_PTE, sizeof(*dst_pfns), GFP_KERNEL | __GFP_NOFAIL); - if (!dst_pfns) - goto free_mem; ret = 0; mmap_read_lock(mm);