• I
    time/timekeeping: Work around false positive GCC warning · 6436257b
    Ingo Molnar 提交于
    Newer GCC versions trigger the following warning:
    
      kernel/time/timekeeping.c: In function ‘get_device_system_crosststamp’:
      kernel/time/timekeeping.c:987:5: warning: ‘clock_was_set_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        if (discontinuity) {
         ^
      kernel/time/timekeeping.c:1045:15: note: ‘clock_was_set_seq’ was declared here
        unsigned int clock_was_set_seq;
                     ^
    
    GCC clearly is unable to recognize that the 'do_interp' boolean tracks
    the initialization status of 'clock_was_set_seq'.
    
    The GCC version used was:
    
      gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
    
    Work it around by initializing clock_was_set_seq to 0. Compilers that
    are able to recognize the code flow will eliminate the unnecessary
    initialization.
    Acked-by: NThomas Gleixner <tglx@linutronix.de>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: NIngo Molnar <mingo@kernel.org>
    6436257b
timekeeping.c 63.6 KB