[PATCH 3/4] lib/test_hmm: remove dead NULL checks after GFP_NOFAIL allocations
From: Gou Hao
Date: Thu Jul 23 2026 - 04:24:02 EST
kvcalloc with the __GFP_NOFAIL flag will never return NULL, so the
subsequent NULL checks are unreachable dead code. Remove them.
Signed-off-by: Gou Hao <gouhao@xxxxxxxxxxxxx>
---
lib/test_hmm.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 9c59d1ceb5b5..d615e4e5fc44 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);
--
2.20.1