[PATCH] x86/msr: Fix coding style issues is msr.c

Mohamad Raizudeen posted 1 patch 2 months, 1 week ago
arch/x86/kernel/msr.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
[PATCH] x86/msr: Fix coding style issues is msr.c
Posted by Mohamad Raizudeen 2 months, 1 week ago
Fix checkpatch.pl errors:

- Move break statements to new line
- Ensure proper tab indentation for break statements
- Remove trailing whitespace

No functional changes.

Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
---
 arch/x86/kernel/msr.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 4469c784eaa0..6cc2aee4d472 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -90,16 +90,17 @@ static int filter_write(u32 reg)
 	static DEFINE_RATELIMIT_STATE(fw_rs, 30 * HZ, 1);
 
 	switch (allow_writes) {
-	case MSR_WRITES_ON:  return 0;
+	case MSR_WRITES_ON: return 0;
 	case MSR_WRITES_OFF: return -EPERM;
-	default: break;
+	default:
+			     break;
 	}
 
 	if (!__ratelimit(&fw_rs))
 		return 0;
 
 	pr_warn("Write to unrecognized MSR 0x%x by %s (pid: %d), tainting CPU_OUT_OF_SPEC.\n",
-	        reg, current->comm, current->pid);
+			reg, current->comm, current->pid);
 	pr_warn("See https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/about for details.\n");
 
 	return 0;
@@ -314,9 +315,15 @@ static int get_allow_writes(char *buf, const struct kernel_param *kp)
 	const char *res;
 
 	switch (allow_writes) {
-	case MSR_WRITES_ON:  res = "on"; break;
-	case MSR_WRITES_OFF: res = "off"; break;
-	default: res = "default"; break;
+	case MSR_WRITES_ON:
+		res = "on";
+		break;
+	case MSR_WRITES_OFF:
+		res = "off";
+		break;
+	default:
+		res = "default";
+		break;
 	}
 
 	return sprintf(buf, "%s\n", res);
-- 
2.43.0
Re: [PATCH] x86/msr: Fix coding style issues is msr.c
Posted by Borislav Petkov 2 months, 1 week ago
On Mon, Apr 06, 2026 at 09:44:25PM +0530, Mohamad Raizudeen wrote:
> Fix checkpatch.pl errors:

Please do not run checkpatch on random files and try to fix things.

In this particular case, the code is this way for a reason and checkpatch is
just a silly tool. We should not trust silly tools blindly but turn on our own
brains and think whether there's a good reason for the way the code is
written.

Thx.

-- 
Regards/Gruss,
    Boris.

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