Message ID | 20220914012113.6271-1-xupengfei@nfschina.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/1] mm/hugetlb: Remove unnecessary 'NULL' values from Pointer | expand |
> On Sep 14, 2022, at 09:21, XU pengfei <xupengfei@nfschina.com> wrote: > > > Pointer variables allocate memory first, and then judge. There is no > need to initialize the assignment. > > Signed-off-by: XU pengfei <xupengfei@nfschina.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks.
Dear Andrew Morton: Thank you for including this patch. This patch shortly appears at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb-remove-unnecessary-null-values-from-pointer.patch This patch later appears in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e070b8593b37..a05f22b1ab1e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -257,7 +257,7 @@ static inline struct hugepage_subpool *subpool_vma(struct vm_area_struct *vma) static struct file_region * get_file_region_entry_from_cache(struct resv_map *resv, long from, long to) { - struct file_region *nrg = NULL; + struct file_region *nrg; VM_BUG_ON(resv->region_cache_count <= 0); @@ -339,7 +339,7 @@ static bool has_same_uncharge_info(struct file_region *rg, static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) { - struct file_region *nrg = NULL, *prg = NULL; + struct file_region *nrg, *prg; prg = list_prev_entry(rg, link); if (&prg->link != &resv->regions && prg->to == rg->from &&
Pointer variables allocate memory first, and then judge. There is no need to initialize the assignment. Signed-off-by: XU pengfei <xupengfei@nfschina.com> --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)