[PATCH 00/10] Clean up some x86/mce code

From: Qiuxu Zhuo
Date: Thu Oct 10 2024 - 12:28:43 EST


1. Clean up some x86/mce code as below. No functional changes intended.

- Simplify some code.

- Remove some unnecessary code.

- Improve readability for some code.

- Fix some typos.

[ Reduce the text segment size by ~116 bytes. ]

2. Pass the following basic tests:

- Compile test.

- Correctable/uncorrectable memory errors can be notified via CMCI/MCE interrupts.

- Correctable/uncorrectable memory errors can be dispatched to the mcelog daemon and the EDAC driver.

[ Tested on an Intel Sapphire Rapids server. ]

3. This patch series is based on v6.12-rc2.

Qiuxu Zhuo (10):
x86/mce/dev-mcelog: Use xchg() to get and clear the flags
x86/mce/intel: Use MCG_BANKCNT_MASK instead of 0xff
x86/mce: Make several functions return bool
x86/mce/threshold: Remove the redundant this_cpu_dec_return()
x86/mce/genpool: Make mce_gen_pool_create() return explicit error codes
x86/mce: Convert multiple if () statements into a switch() statement
x86/mce: Remove the unnecessary {}
x86/mce: Remove the redundant zeroing assignments
x86/mce/amd: Remove unnecessary NULL pointer initializations
x86/mce: Fix typos in comments

arch/x86/include/asm/mce.h | 4 +--
arch/x86/kernel/cpu/mce/amd.c | 18 +++++------
arch/x86/kernel/cpu/mce/core.c | 47 ++++++++++++++--------------
arch/x86/kernel/cpu/mce/dev-mcelog.c | 11 ++-----
arch/x86/kernel/cpu/mce/genpool.c | 8 ++---
arch/x86/kernel/cpu/mce/intel.c | 11 ++++---
arch/x86/kernel/cpu/mce/threshold.c | 2 +-
7 files changed, 46 insertions(+), 55 deletions(-)


base-commit: 8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b
--
2.17.1