Re: [PATCH 2/2] x86: Fix typo in MSR_IA32_MISC_ENABLE_LIMIT_CPUID macro

From: Borislav Petkov
Date: Fri May 09 2014 - 06:33:13 EST


On Fri, May 09, 2014 at 09:57:30AM +0200, Borislav Petkov wrote:
> > diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
> > index c827ace..fcf2b3a 100644
> > --- a/arch/x86/include/uapi/asm/msr-index.h
> > +++ b/arch/x86/include/uapi/asm/msr-index.h
> > @@ -384,7 +384,7 @@
> > #define MSR_IA32_MISC_ENABLE_MWAIT_BIT 18
> > #define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
> > #define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT 22
> > -#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT);
> > +#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT)

Btw, we should probably be catching typos like that with checkpatch.
Here's an initial version for single-line macros:

---
From: Borislav Petkov <bp@xxxxxxx>
Subject: [PATCH] checkpatch: Catch trailing semicolons in macro definitions

This currently checks only single-line macro definitions. I.e.,

$ git show c0a639ad0bc6b178b46996bd1f821a04643e2bde | ./scripts/checkpatch.pl -

...
WARNING: Trailing semicolon at macro definition
+#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_BIT_LIMIT_CPUID);

Signed-off-by: Borislav Petkov <bp@xxxxxxx>
---
scripts/checkpatch.pl | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 34eb2160489d..04929c20c9b5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3313,6 +3313,11 @@ sub process {
}
}

+ if ($line =~ /^\+\s*#\s*define\s.*;\s*$/) {
+ WARN("TRAILING_SEMICOLON",
+ "Trailing semicolon at macro definition\n" . $herecurr);
+ }
+
# check for multiple assignments
if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
CHK("MULTIPLE_ASSIGNMENTS",
--
1.9.0

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/