• Ingo Molnar's avatar
    x86/oprofile: Fix uninitialized variable use in debug printk · 2c78ffec
    Ingo Molnar authored
    Stephen Rothwell reported this build warning:
    
      arch/x86/oprofile/op_model_amd.c: In function 'ibs_eilvt_valid':
      arch/x86/oprofile/op_model_amd.c:289: warning: 'offset' may be used uninitialized in this function
    
    And correctly observed that indeed the variable is used uninitialized in
    this function. The result of this bug can be a debug printk with a bogus
    value.
    
    Also fix a few more small details that made this function hard to read
    and which probably contributed to the bug being introduced to begin with:
    
     - Use more symmetric error conditions
    
     - Remove the !0 obfuscation
    
     - Add newlines to the printk output
    
     - Remove bogus linebreaks in printk strings and elsewhere
    Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
    Cc: Robert Richter <robert.richter@amd.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    LKML-Reference: <20101025115736.41d51abe.sfr@canb.auug.org.au>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    2c78ffec
op_model_amd.c 15.1 KB