Commit:     18420001d6ceafbe094a6f911126c6eee34d25c4
Parent:     959b4fdfe7e27bcf101e2381e500e4076f2bb9ce
Author:     Zachary Amsden <[EMAIL PROTECTED]>
AuthorDate: Wed May 2 19:27:16 2007 +0200
Committer:  Andi Kleen <[EMAIL PROTECTED]>
CommitDate: Wed May 2 19:27:16 2007 +0200

    [PATCH] i386: Clean up arch/i386/kernel/cpu/mcheck/p4.c
    No, just no.  You do not use goto to skip a code block.  You do not
    return an obvious variable from a singly-inlined function and give
    the function a return value.  You don't put unexplained comments
    about kmalloc in code which doesn't do dynamic allocation.  And
    you don't leave stray warnings around for no good reason.
    Also, when possible, it is better to use block scoped variables
    because gcc can sometime generate better code.
    Signed-off-by: Zachary Amsden <[EMAIL PROTECTED]>
    Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>
 arch/i386/kernel/cpu/mcheck/p4.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/i386/kernel/cpu/mcheck/p4.c b/arch/i386/kernel/cpu/mcheck/p4.c
index 504434a..1509edf 100644
--- a/arch/i386/kernel/cpu/mcheck/p4.c
+++ b/arch/i386/kernel/cpu/mcheck/p4.c
@@ -124,13 +124,10 @@ static void intel_init_thermal(struct cpuinfo_x86 *c)
 /* P4/Xeon Extended MCE MSR retrieval, return 0 if unsupported */
-static inline int intel_get_extended_msrs(struct intel_mce_extended_msrs *r)
+static inline void intel_get_extended_msrs(struct intel_mce_extended_msrs *r)
        u32 h;
-       if (mce_num_extended_msrs == 0)
-               goto done;
        rdmsr (MSR_IA32_MCG_EAX, r->eax, h);
        rdmsr (MSR_IA32_MCG_EBX, r->ebx, h);
        rdmsr (MSR_IA32_MCG_ECX, r->ecx, h);
@@ -141,12 +138,6 @@ static inline int intel_get_extended_msrs(struct 
intel_mce_extended_msrs *r)
        rdmsr (MSR_IA32_MCG_ESP, r->esp, h);
        rdmsr (MSR_IA32_MCG_EFLAGS, r->eflags, h);
        rdmsr (MSR_IA32_MCG_EIP, r->eip, h);
-       /* can we rely on kmalloc to do a dynamic
-        * allocation for the reserved registers?
-        */
-       return mce_num_extended_msrs;
 static fastcall void intel_machine_check(struct pt_regs * regs, long 
@@ -155,7 +146,6 @@ static fastcall void intel_machine_check(struct pt_regs * 
regs, long error_code)
        u32 alow, ahigh, high, low;
        u32 mcgstl, mcgsth;
        int i;
-       struct intel_mce_extended_msrs dbg;
        rdmsr (MSR_IA32_MCG_STATUS, mcgstl, mcgsth);
        if (mcgstl & (1<<0))    /* Recoverable ? */
@@ -164,7 +154,9 @@ static fastcall void intel_machine_check(struct pt_regs * 
regs, long error_code)
        printk (KERN_EMERG "CPU %d: Machine Check Exception: %08x%08x\n",
                smp_processor_id(), mcgsth, mcgstl);
-       if (intel_get_extended_msrs(&dbg)) {
+       if (mce_num_extended_msrs > 0) {
+               struct intel_mce_extended_msrs dbg;
+               intel_get_extended_msrs(&dbg);
                printk (KERN_DEBUG "CPU %d: EIP: %08x EFLAGS: %08x\n",
                        smp_processor_id(), dbg.eip, dbg.eflags);
                printk (KERN_DEBUG "\teax: %08x ebx: %08x ecx: %08x edx: 
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to