2022-06-12 18:42:17

by Gautam Menghani

[permalink] [raw]
Subject: [PATCH] mm: Remove unwanted initialization in vmemmap_populate_compound_pages()

Remove unwanted initialization for the variable 'next'. This fixes the
clang scan warning: Value stored to 'next' during its initialization is
never read [deadcode.DeadStores]

Signed-off-by: Gautam Menghani <[email protected]>
---
mm/sparse-vmemmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index f4fa61dbbee3..3008aa7859e0 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -737,7 +737,7 @@ static int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,

size = min(end - start, pgmap_vmemmap_nr(pgmap) * sizeof(struct page));
for (addr = start; addr < end; addr += size) {
- unsigned long next = addr, last = addr + size;
+ unsigned long next, last = addr + size;

/* Populate the head page vmemmap page */
pte = vmemmap_populate_address(addr, node, NULL, NULL);
--
2.25.1


2022-06-13 07:53:26

by Muchun Song

[permalink] [raw]
Subject: Re: [PATCH] mm: Remove unwanted initialization in vmemmap_populate_compound_pages()

On Sun, Jun 12, 2022 at 11:23:20AM -0700, Gautam Menghani wrote:
> Remove unwanted initialization for the variable 'next'. This fixes the
> clang scan warning: Value stored to 'next' during its initialization is
> never read [deadcode.DeadStores]
>
> Signed-off-by: Gautam Menghani <[email protected]>

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

Thanks.

2022-06-13 18:40:40

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] mm: Remove unwanted initialization in vmemmap_populate_compound_pages()

On 12.06.22 20:23, Gautam Menghani wrote:
> Remove unwanted initialization for the variable 'next'. This fixes the
> clang scan warning: Value stored to 'next' during its initialization is
> never read [deadcode.DeadStores]
>

Nit: s/unwanted/unnecessary/

Reviewed-by: David Hildenbrand <[email protected]>

> Signed-off-by: Gautam Menghani <[email protected]>
> ---
> mm/sparse-vmemmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
> index f4fa61dbbee3..3008aa7859e0 100644
> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -737,7 +737,7 @@ static int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,
>
> size = min(end - start, pgmap_vmemmap_nr(pgmap) * sizeof(struct page));
> for (addr = start; addr < end; addr += size) {
> - unsigned long next = addr, last = addr + size;
> + unsigned long next, last = addr + size;
>
> /* Populate the head page vmemmap page */
> pte = vmemmap_populate_address(addr, node, NULL, NULL);


--
Thanks,

David / dhildenb

2022-06-14 10:55:26

by Joao Martins

[permalink] [raw]
Subject: Re: [PATCH] mm: Remove unwanted initialization in vmemmap_populate_compound_pages()

On 6/12/22 19:23, Gautam Menghani wrote:
> Remove unwanted initialization for the variable 'next'. This fixes the
> clang scan warning: Value stored to 'next' during its initialization is
> never read [deadcode.DeadStores]
>
> Signed-off-by: Gautam Menghani <[email protected]>

Ugh, thanks for catching that:

Reviewed-by: Joao Martins <[email protected]>

> ---
> mm/sparse-vmemmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
> index f4fa61dbbee3..3008aa7859e0 100644
> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -737,7 +737,7 @@ static int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,
>
> size = min(end - start, pgmap_vmemmap_nr(pgmap) * sizeof(struct page));
> for (addr = start; addr < end; addr += size) {
> - unsigned long next = addr, last = addr + size;
> + unsigned long next, last = addr + size;
>
> /* Populate the head page vmemmap page */
> pte = vmemmap_populate_address(addr, node, NULL, NULL);

2022-06-15 07:56:06

by Oscar Salvador

[permalink] [raw]
Subject: Re: [PATCH] mm: Remove unwanted initialization in vmemmap_populate_compound_pages()

On Sun, Jun 12, 2022 at 11:23:20AM -0700, Gautam Menghani wrote:
> Remove unwanted initialization for the variable 'next'. This fixes the
> clang scan warning: Value stored to 'next' during its initialization is
> never read [deadcode.DeadStores]
>
> Signed-off-by: Gautam Menghani <[email protected]>

Reviewed-by: Oscar Salvador <[email protected]>


--
Oscar Salvador
SUSE Labs