Skip to contentSkip to conversation

x86/mce: remove unused WARN_ON() in mce_register_decode_chain()

PATCH In review Zhen Lei 2 participants 3 messages Nov 6, 2020

Subsystems (3)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 x86/mce: remove unused WARN_ON() in mce_register_decode_chain()

enum mce_notifier_prios {
MCE_PRIO_LOWEST,
MCE_PRIO_MCELOG,
MCE_PRIO_EDAC,

After commit c9c6d216ed28 ("x86/mce: Rename "first" function as "early""), there is no other integer between MCE_PRIO_MCELOG and MCE_PRIO_EDAC. Therefore, the WARN_ON() will never be triggered, just delete it.

---
 arch/x86/kernel/cpu/mce/core.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/mce/core.c +0 -3
index 4102b866e7c0..914f9f102995 100644
@@ -162,9 +162,6 @@ EXPORT_SYMBOL_GPL(mce_log);
 
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
-		return;
-
 	blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);
 }
 EXPORT_SYMBOL_GPL(mce_register_decode_chain);
Signature · 1 line
2.26.0.106.g9fadedd
maintainer
#1 lore raw
Quoted 19 lines · Zhen Lei

enum mce_notifier_prios {
MCE_PRIO_LOWEST,
MCE_PRIO_MCELOG,
MCE_PRIO_EDAC,

After commit c9c6d216ed28 ("x86/mce: Rename "first" function as "early""), there is no other integer between MCE_PRIO_MCELOG and MCE_PRIO_EDAC. Therefore, the WARN_ON() will never be triggered, just delete it.

---
 arch/x86/kernel/cpu/mce/core.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/mce/core.c +0 -0
index 4102b866e7c0..914f9f102995 100644

arch/x86/kernel/cpu/mce/core.c EXPORT_SYMBOL_GPL(mce_log); · line 166

Quoted 5 lines
arch/x86/kernel/cpu/mce/core.c +0 -2
@@ -162,9 +162,6 @@ EXPORT_SYMBOL_GPL(mce_log);
 
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
-		return;

No, you don't want to remove it - you want to update it so that it catches wrong priorities...

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw
Quoted 21 lines · Borislav Petkov
Quoted 20 lines · Zhen Lei

enum mce_notifier_prios {
MCE_PRIO_LOWEST,
MCE_PRIO_MCELOG,
MCE_PRIO_EDAC,

After commit c9c6d216ed28 ("x86/mce: Rename "first" function as "early""), there is no other integer between MCE_PRIO_MCELOG and MCE_PRIO_EDAC. Therefore, the WARN_ON() will never be triggered, just delete it.

---
 arch/x86/kernel/cpu/mce/core.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kernel/cpu/mce/core.c +0 -0
index 4102b866e7c0..914f9f102995 100644
@@ -162,9 +162,6 @@ EXPORT_SYMBOL_GPL(mce_log);
 
Quoted 7 lines

arch/x86/kernel/cpu/mce/core.c EXPORT_SYMBOL_GPL(mce_log); · line 166

Quoted 4 lines
arch/x86/kernel/cpu/mce/core.c +0 -2
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
-		return;

No, you don't want to remove it - you want to update it so that it catches wrong priorities...

Oh, Yes, You're right. I will send v2.

Quoted 3 lines

Thx.