Skip to contentSkip to conversation

x86/apic: Delete useless BUG_ON in validate_apic_and_package_id()

PATCH In review Peng Liu 2 participants 2 messages Mar 8, 2024 x86

lore
Share & tools
lore

Peng Liu

author
#0 lore raw

PATCH 1/1 x86/apic: Delete useless BUG_ON in validate_apic_and_package_id()

Both topology_update_package_map() and topology_update_die_map() have a fixed return value 0. That is, they never fail. So the BUG_ON() checks on them are useless and better be deleted.

---
 arch/x86/kernel/cpu/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/common.c +2 -2
index fbc4e60d027c..44b08de3971c 100644
@@ -1796,8 +1796,8 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
 		pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",
 		       cpu, apicid, c->topo.initial_apicid);
 	}
-	BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
-	BUG_ON(topology_update_die_map(c->topo.die_id, cpu));
+	topology_update_package_map(c->topo.pkg_id, cpu);
+	topology_update_die_map(c->topo.die_id, cpu);
 #else
 	c->topo.logical_pkg_id = 0;
 #endif
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 15 lines · Peng Liu

Both topology_update_package_map() and topology_update_die_map() have a fixed return value 0. That is, they never fail. So the BUG_ON() checks on them are useless and better be deleted.

---
 arch/x86/kernel/cpu/common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/common.c +0 -0
index fbc4e60d027c..44b08de3971c 100644

arch/x86/kernel/cpu/common.c static void validate_apic_and_package_id(struct cpuinfo_x86 *c) · line 1803

Quoted 10 lines
arch/x86/kernel/cpu/common.c +2 -2
@@ -1796,8 +1796,8 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
 		pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",
 		       cpu, apicid, c->topo.initial_apicid);
 	}
-	BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
-	BUG_ON(topology_update_die_map(c->topo.die_id, cpu));
+	topology_update_package_map(c->topo.pkg_id, cpu);
+	topology_update_die_map(c->topo.die_id, cpu);
 #else
 	c->topo.logical_pkg_id = 0;
 #endif

https://lore.kernel.org/r/[email protected]

If you wanna do arch/x86/ patches, do them always ontop of tip/master or the current linux-next master branch.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette