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 <[email protected]>
---
 lib/test_hmm.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 9c59d1ceb5b57..d615e4e5fc447 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


Reply via email to