Re: [PATCH v2 5/6] lib/test_hmm: remove dead NULL checks after GFP_NOFAIL allocations
Alistair Popple <[email protected]> Mon, 27 Jul 2026 11:41:27 +1000
| Newsgroups | org.kernel.vger.linux-rdma,org.kernel.vger.linux-kernel,org.kvack.linux-mm,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
On 2026-07-24 at 12:28 +1000, Gou Hao <[email protected]> wrote... > kvcalloc with the __GFP_NOFAIL flag will never return NULL, so the > subsequent NULL checks are unreachable dead code. Remove them. Reviewed-by: Alistair Popple <[email protected]> > 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 > >