Skip to contentSkip to conversation

x86/paravirt: hide unused patch_default label

PATCH In review Arnd Bergmann 2 participants 3 messages Dec 16, 2016

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

PATCH 1/1 x86/paravirt: hide unused patch_default label

A bugfix introduced a harmless warning:

arch/x86/kernel/paravirt_patch_32.c: In function 'native_patch':
arch/x86/kernel/paravirt_patch_32.c:71:1: error: label 'patch_default' defined but not used [-Werror=unused-label]

This puts it in the same #ifdef as its caller.

Fixes 45dbea5f55c0 ("x86/paravirt: Fix native_patch()")
---
 arch/x86/kernel/paravirt_patch_32.c | 2 ++
 arch/x86/kernel/paravirt_patch_64.c | 2 ++
 2 files changed, 4 insertions(+)
arch/x86/kernel/paravirt_patch_32.c +2 -0
index d33ef165b1f8..2b729b1df391 100644
@@ -68,7 +68,9 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
 #endif
 
 	default:
+#if defined(CONFIG_PARAVIRT_SPINLOCKS)
 patch_default:
+#endif
 		ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
 		break;
 
arch/x86/kernel/paravirt_patch_64.c +2 -0
index f4fcf26c9fce..b5bff128949a 100644
@@ -80,7 +80,9 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
 #endif
 
 	default:
+#if defined(CONFIG_PARAVIRT_SPINLOCKS)
 patch_default:
+#endif
 		ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
 		break;
 
Signature · 1 line
2.9.0
#1 lore raw
Quoted 10 lines · Arnd Bergmann

A bugfix introduced a harmless warning:

arch/x86/kernel/paravirt_patch_32.c: In function 'native_patch':
arch/x86/kernel/paravirt_patch_32.c:71:1: error: label 'patch_default' defined but not used [-Werror=unused-label]

This puts it in the same #ifdef as its caller.

Fixes 45dbea5f55c0 ("x86/paravirt: Fix native_patch()")

---

This seems to work as well and is less invasive

 arch/x86/kernel/paravirt_patch_32.c | 2 +-
 arch/x86/kernel/paravirt_patch_64.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/paravirt_patch_32.c +1 -1
index d33ef165b1f8..553acbbb4d32 100644
@@ -68,7 +68,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
 #endif
 
 	default:
-patch_default:
+patch_default: __maybe_unused
 		ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
 		break;
 
arch/x86/kernel/paravirt_patch_64.c +1 -1
index f4fcf26c9fce..11aaf1eaa0e4 100644
@@ -80,7 +80,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
 #endif
 
 	default:
-patch_default:
+patch_default: __maybe_unused
 		ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
 		break;
#2 lore raw

arch/x86/kernel/paravirt_patch_32.c unsigned native_patch(u8 type, u16 clobbers, void *ibuf, · line 73

Quoted 5 lines · CET Peter Zijlstra
arch/x86/kernel/paravirt_patch_32.c +1 -1
-patch_default:
+patch_default: __maybe_unused
                ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
                break;

Ah, nice, I didn't know you could do that. Yes, please do this instead.

Arnd