Skip to contentSkip to conversation

x86/bugs: Fix return type of spectre_bhi_state()

PATCH Applied Daniel Sneddon 3 participants 3 messages Apr 9, 2024 – Apr 10, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/bugs: Fix return type of spectre_bhi_state()

The definition of spectre_bhi_state() incorrectly returns a const char
* const. This causes the a compiler warning when building with W=1.

warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2812 | static const char * const spectre_bhi_state(void)

Remove the const qualifier from the pointer.

Fixes ec9404e40e8f ("x86/bhi: Add BHI mitigation knob")
---
 arch/x86/kernel/cpu/bugs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index e1775debeafe..7e4a706cad80 100644
@@ -2809,7 +2809,7 @@ static char *pbrsb_eibrs_state(void)
 	}
 }
 
-static const char * const spectre_bhi_state(void)
+static const char *spectre_bhi_state(void)
 {
 	if (!boot_cpu_has_bug(X86_BUG_BHI))
 		return "; BHI: Not affected";
Signature · 1 line
2.25.1
merge bot Applied
#1 lore raw
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     04f4230e2f86a4e961ea5466eda3db8c1762004d
Gitweb:        https://git.kernel.org/tip/04f4230e2f86a4e961ea5466eda3db8c1762004d
Author:        Daniel Sneddon <[email protected]>
AuthorDate:    Tue, 09 Apr 2024 16:08:05 -07:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Wed, 10 Apr 2024 07:05:04 +02:00

x86/bugs: Fix return type of spectre_bhi_state()

The definition of spectre_bhi_state() incorrectly returns a const char
* const. This causes the a compiler warning when building with W=1:

warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2812 | static const char * const spectre_bhi_state(void)

Remove the const qualifier from the pointer.

Fixes ec9404e40e8f ("x86/bhi: Add BHI mitigation knob")
Cc Linus Torvalds <[email protected]>
---
 arch/x86/kernel/cpu/bugs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +1 -1
index 2954637..27f5004 100644
@@ -2809,7 +2809,7 @@ static char *pbrsb_eibrs_state(void)
 	}
 }
 
-static const char * const spectre_bhi_state(void)
+static const char *spectre_bhi_state(void)
 {
 	if (!boot_cpu_has_bug(X86_BUG_BHI))
 		return "; BHI: Not affected";
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Sneddon
Quoted 20 lines · Daniel Sneddon

The definition of spectre_bhi_state() incorrectly returns a const char
* const. This causes the a compiler warning when building with W=1.

warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 2812 | static const char * const spectre_bhi_state(void)

Remove the const qualifier from the pointer.

Fixes ec9404e40e8f ("x86/bhi: Add BHI mitigation knob")
---
  arch/x86/kernel/cpu/bugs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +0 -0
index e1775debeafe..7e4a706cad80 100644

arch/x86/kernel/cpu/bugs.c static char *pbrsb_eibrs_state(void) · line 2815

Quoted 8 lines
arch/x86/kernel/cpu/bugs.c +1 -1
@@ -2809,7 +2809,7 @@ static char *pbrsb_eibrs_state(void)
  	}
  }
 
-static const char * const spectre_bhi_state(void)
+static const char *spectre_bhi_state(void)
  {
  	if (!boot_cpu_has_bug(X86_BUG_BHI))
  		return "; BHI: Not affected";

alex.