Skip to contentSkip to conversation

arch/sparc: fix unused vaiable warning error

PATCH Superseded [email protected] 3 participants 3 messages Jan 7 SPARC + UltraSPARC (sparc/sparc64)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/sparc: fix unused vaiable warning error

From: Alex Shi <[email protected]>

arch/sparc/mm/init_64.c: In function 'arch_hugetlb_valid_size':
arch/sparc/mm/init_64.c:361:24: warning: variable 'hv_pgsz_idx' set but not used [-Wunused-but-set-variable]

     361 |         unsigned short hv_pgsz_idx;
         |                        ^~~~~~~~~~~
Cc Matthew Wilcox <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Qi Zheng <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Zi Yan <[email protected]>
Cc Kevin Brodsky <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc David S. Miller <[email protected]>
---
 arch/sparc/mm/init_64.c | 6 ------
 1 file changed, 6 deletions(-)
arch/sparc/mm/init_64.c +0 -6
index df9f7c444c39..ba19d23d4040 100644
@@ -358,30 +358,24 @@ static void __init pud_huge_patch(void)
 bool __init arch_hugetlb_valid_size(unsigned long size)
 {
 	unsigned int hugepage_shift = ilog2(size);
-	unsigned short hv_pgsz_idx;
 	unsigned int hv_pgsz_mask;
 
 	switch (hugepage_shift) {
 	case HPAGE_16GB_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_16GB;
-		hv_pgsz_idx = HV_PGSZ_IDX_16GB;
 		pud_huge_patch();
 		break;
 	case HPAGE_2GB_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_2GB;
-		hv_pgsz_idx = HV_PGSZ_IDX_2GB;
 		break;
 	case HPAGE_256MB_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_256MB;
-		hv_pgsz_idx = HV_PGSZ_IDX_256MB;
 		break;
 	case HPAGE_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_4MB;
-		hv_pgsz_idx = HV_PGSZ_IDX_4MB;
 		break;
 	case HPAGE_64K_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_64K;
-		hv_pgsz_idx = HV_PGSZ_IDX_64K;
 		break;
 	default:
 		hv_pgsz_mask = 0;
Signature · 1 line
2.43.0
#1 lore raw

Hi Alex,

Quoted 49 lines · On Wed, 2026-01-07 at 14:42 +0800, [email protected] wrote:

From: Alex Shi <[email protected]>

arch/sparc/mm/init_64.c: In function 'arch_hugetlb_valid_size':

   arch/sparc/mm/init_64.c:361:24: warning: variable 'hv_pgsz_idx' set but not used [-Wunused-but-set-variable]
     361 |         unsigned short hv_pgsz_idx;
         |                        ^~~~~~~~~~~
Cc Matthew Wilcox <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Qi Zheng <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Zi Yan <[email protected]>
Cc Kevin Brodsky <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc David S. Miller <[email protected]>
---
 arch/sparc/mm/init_64.c | 6 ------
 1 file changed, 6 deletions(-)
arch/sparc/mm/init_64.c +0 -4
index df9f7c444c39..ba19d23d4040 100644
@@ -358,30 +358,24 @@ static void __init pud_huge_patch(void)
 bool __init arch_hugetlb_valid_size(unsigned long size)
 {
 	unsigned int hugepage_shift = ilog2(size);
-	unsigned short hv_pgsz_idx;
 	unsigned int hv_pgsz_mask;
 
 	switch (hugepage_shift) {
 	case HPAGE_16GB_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_16GB;
-		hv_pgsz_idx = HV_PGSZ_IDX_16GB;
 		pud_huge_patch();
 		break;
 	case HPAGE_2GB_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_2GB;
-		hv_pgsz_idx = HV_PGSZ_IDX_2GB;
 		break;
 	case HPAGE_256MB_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_256MB;
-		hv_pgsz_idx = HV_PGSZ_IDX_256MB;
 		break;

arch/sparc/mm/init_64.c static void __init pud_huge_patch(void) · line 381

Quoted 10 lines
arch/sparc/mm/init_64.c +0 -2
 	case HPAGE_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_4MB;
-		hv_pgsz_idx = HV_PGSZ_IDX_4MB;
 		break;
 	case HPAGE_64K_SHIFT:
 		hv_pgsz_mask = HV_PGSZ_MASK_64K;
-		hv_pgsz_idx = HV_PGSZ_IDX_64K;
 		break;
 	default:
 		hv_pgsz_mask = 0;

Thanks for the patch! Could you fix the typo in the subject?

Thanks,
Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#2 lore raw
Quoted 55 lines · John Paul Adrian Glaubitz

Hi Alex,

Quoted 52 lines · On Wed, 2026-01-07 at 14:42 +0800,[email protected] wrote:

From: Alex Shi<[email protected]>

arch/sparc/mm/init_64.c: In function 'arch_hugetlb_valid_size':
arch/sparc/mm/init_64.c:361:24: warning: variable 'hv_pgsz_idx' set but not used [-Wunused-but-set-variable]
361 | unsigned short hv_pgsz_idx;
| ^~~~~~~~~~~

Cc Matthew Wilcox<[email protected]>
Cc Lorenzo Stoakes<[email protected]>
Cc Qi Zheng<[email protected]>
Cc Dave Hansen<[email protected]>
Cc Kevin Brodsky<[email protected]>
Cc Mike Rapoport<[email protected]>
Cc Andrew Morton<[email protected]>
Cc Andreas Larsson<[email protected]>
Cc David S. Miller<[email protected]>
---
  arch/sparc/mm/init_64.c | 6 ------
  1 file changed, 6 deletions(-)
arch/sparc/mm/init_64.c +0 -5
index df9f7c444c39..ba19d23d4040 100644
@@ -358,30 +358,24 @@ static void __init pud_huge_patch(void)
  bool __init arch_hugetlb_valid_size(unsigned long size)
  {
  	unsigned int hugepage_shift = ilog2(size);
-	unsigned short hv_pgsz_idx;
  	unsigned int hv_pgsz_mask;
 
  	switch (hugepage_shift) {
  	case HPAGE_16GB_SHIFT:
  		hv_pgsz_mask = HV_PGSZ_MASK_16GB;
-		hv_pgsz_idx = HV_PGSZ_IDX_16GB;
  		pud_huge_patch();
  		break;
  	case HPAGE_2GB_SHIFT:
  		hv_pgsz_mask = HV_PGSZ_MASK_2GB;
-		hv_pgsz_idx = HV_PGSZ_IDX_2GB;
  		break;
  	case HPAGE_256MB_SHIFT:
  		hv_pgsz_mask = HV_PGSZ_MASK_256MB;
-		hv_pgsz_idx = HV_PGSZ_IDX_256MB;
  		break;
  	case HPAGE_SHIFT:
  		hv_pgsz_mask = HV_PGSZ_MASK_4MB;
-		hv_pgsz_idx = HV_PGSZ_IDX_4MB;
Quoted 8 lines

arch/sparc/mm/init_64.c static void __init pud_huge_patch(void) · line 381

Quoted 7 lines
arch/sparc/mm/init_64.c +0 -1
  		break;
  	case HPAGE_64K_SHIFT:
  		hv_pgsz_mask = HV_PGSZ_MASK_64K;
-		hv_pgsz_idx = HV_PGSZ_IDX_64K;
  		break;
  	default:
  		hv_pgsz_mask = 0;

Thanks for the patch! Could you fix the typo in the subject?

Thanks a lot. I will update the subject and resend for v2.

Thanks
Alex

Quoted 7 lines

Thanks,
Adrian

-- .''. John Paul Adrian Glaubitz : :' : Debian Developer . ' Physicist - GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913