Skip to contentSkip to conversation

openrisc: mm/init.c: fix compilation warnings

PATCH In review Mike Rapoport 2 participants 5 messages May 9, 2021 Openrisc architecture

lore
Share & tools
lore
#0 lore raw

cover openrisc: mm/init.c: fix compilation warnings

From: Mike Rapoport <[email protected]>

Hi,

Kbuld test bot reported an unused in map_ram() and while on it I've found another compilation warning about unused variable in paging_init().

Here are the fixes for both.
The patches are vs 5.12.

Mike Rapoport (2):
openrisc: mm/init.c: remove unused memblock_region variable in map_ram()
openrisc: mm/init.c: remove unused variable 'end' in paging_init()

 arch/openrisc/mm/init.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

base-commit: 9f4ad9e425a1d3b6a34617b8ea226d56a119a717

Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/2 openrisc: mm/init.c: remove unused memblock_region variable in map_ram()

From: Mike Rapoport <[email protected]>

Kernel test robot reports:

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

Quoted 1 line
Quoted 1 line

arch/openrisc/mm/init.c:125:10: warning: Uninitialized variable: region [uninitvar]

            region->base, region->base + region->size);
            ^

Replace usage of memblock_region fields with 'start' and 'end' variables that are initialized in for_each_mem_range() and remove the declaration of region.

Fixes b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()")
---
 arch/openrisc/mm/init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/openrisc/mm/init.c +1 -2
index bf9b2310fc93..f3fa02b8838a 100644
@@ -75,7 +75,6 @@ static void __init map_ram(void)
 	/* These mark extents of read-only kernel pages...
 	 * ...from vmlinux.lds.S
 	 */
-	struct memblock_region *region;
 
 	v = PAGE_OFFSET;
 
@@ -121,7 +120,7 @@ static void __init map_ram(void)
 		}
 
 		printk(KERN_INFO "%s: Memory: 0x%x-0x%x\n", __func__,
-		       region->base, region->base + region->size);
+		       start, end);
 	}
 }
 
Signature · 1 line
2.28.0
#3 lore raw

PATCH 2/2 openrisc: mm/init.c: remove unused variable 'end' in paging_init()

In reply to Mike Rapoport

From: Mike Rapoport <[email protected]>

A build with W=1 enabled produces the following warning:

CC arch/openrisc/mm/init.o
arch/openrisc/mm/init.c: In function 'paging_init':
arch/openrisc/mm/init.c:131:16: warning: variable 'end' set but not used [-Wunused-but-set-variable]
131 | unsigned long end;
| ^~~

Remove the unused variable 'end'.

---
 arch/openrisc/mm/init.c | 3 ---
 1 file changed, 3 deletions(-)
arch/openrisc/mm/init.c +0 -3
index f3fa02b8838a..6e38ec96cab8 100644
@@ -128,7 +128,6 @@ void __init paging_init(void)
 {
 	extern void tlb_init(void);
 
-	unsigned long end;
 	int i;
 
 	printk(KERN_INFO "Setting up paging and PTEs.\n");
@@ -144,8 +143,6 @@ void __init paging_init(void)
 	 */
 	current_pgd[smp_processor_id()] = init_mm.pgd;
 
-	end = (unsigned long)__va(max_low_pfn * PAGE_SIZE);
-
 	map_ram();
 
 	zone_sizes_init();
Signature · 1 line
2.28.0
maintainer
#2 lore raw

Re: [PATCH 1/2] openrisc: mm/init.c: remove unused memblock_region variable in map_ram()

In reply to Mike Rapoport
Quoted 34 lines · Mike Rapoport

From: Mike Rapoport <[email protected]>

Kernel test robot reports:

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

Quoted 1 line
Quoted 1 line

arch/openrisc/mm/init.c:125:10: warning: Uninitialized variable: region [uninitvar]

            region->base, region->base + region->size);
            ^

Replace usage of memblock_region fields with 'start' and 'end' variables that are initialized in for_each_mem_range() and remove the declaration of region.

Fixes b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()")
---
 arch/openrisc/mm/init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/openrisc/mm/init.c +0 -1
index bf9b2310fc93..f3fa02b8838a 100644
@@ -75,7 +75,6 @@ static void __init map_ram(void)
 	/* These mark extents of read-only kernel pages...
 	 * ...from vmlinux.lds.S
 	 */
-	struct memblock_region *region;
 
 	v = PAGE_OFFSET;
 

arch/openrisc/mm/init.c static void __init map_ram(void) · line 125

Quoted 7 lines
arch/openrisc/mm/init.c +1 -1
@@ -121,7 +120,7 @@ static void __init map_ram(void)
 		}
 
 		printk(KERN_INFO "%s: Memory: 0x%x-0x%x\n", __func__,
-		       region->base, region->base + region->size);
+		       start, end);
 	}
 }

Thanks I will queue this.

-Stafford

maintainer
#4 lore raw

Re: [PATCH 2/2] openrisc: mm/init.c: remove unused variable 'end' in paging_init()

In reply to Mike Rapoport
Quoted 30 lines · Mike Rapoport

From: Mike Rapoport <[email protected]>

A build with W=1 enabled produces the following warning:

CC arch/openrisc/mm/init.o
arch/openrisc/mm/init.c: In function 'paging_init':
arch/openrisc/mm/init.c:131:16: warning: variable 'end' set but not used [-Wunused-but-set-variable]
131 | unsigned long end;
| ^~~

Remove the unused variable 'end'.

---
 arch/openrisc/mm/init.c | 3 ---
 1 file changed, 3 deletions(-)
arch/openrisc/mm/init.c +0 -1
index f3fa02b8838a..6e38ec96cab8 100644
@@ -128,7 +128,6 @@ void __init paging_init(void)
 {
 	extern void tlb_init(void);
 
-	unsigned long end;
 	int i;
 
 	printk(KERN_INFO "Setting up paging and PTEs.\n");

arch/openrisc/mm/init.c void __init paging_init(void) · line 148

Quoted 8 lines
arch/openrisc/mm/init.c +0 -2
@@ -144,8 +143,6 @@ void __init paging_init(void)
 	 */
 	current_pgd[smp_processor_id()] = init_mm.pgd;
 
-	end = (unsigned long)__va(max_low_pfn * PAGE_SIZE);
-
 	map_ram();
 
 	zone_sizes_init();

Thanks, I will queue this in the openrisc fixes queue.

-Stafford