2022-09-14 01:54:43

by XU pengfei

[permalink] [raw]
Subject: [PATCH 1/1] mm/hugetlb: Remove unnecessary 'NULL' values from Pointer


Pointer variables allocate memory first, and then judge. There is no
need to initialize the assignment.

Signed-off-by: XU pengfei <[email protected]>
---
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

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 &&
--
2.18.2


2022-09-14 07:12:42

by Muchun Song

[permalink] [raw]
Subject: Re: [PATCH 1/1] mm/hugetlb: Remove unnecessary 'NULL' values from Pointer



> On Sep 14, 2022, at 09:21, XU pengfei <[email protected]> wrote:
>
>
> Pointer variables allocate memory first, and then judge. There is no
> need to initialize the assignment.
>
> Signed-off-by: XU pengfei <[email protected]>

Reviewed-by: Muchun Song <[email protected]>

Thanks.

2022-09-15 01:24:57

by XU pengfei

[permalink] [raw]
Subject: Re: [PATCH 1/1] mm/hugetlb: Remove unnecessary 'NULL' values from Pointer


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