From 6c581bc43ffd857d626b0918b580d6e14f2c5906 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sat, 22 Jul 2017 18:04:08 -0600 Subject: [PATCH] soc/dmp/vortex86: Fix CMOS read and random RTC reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The array of CMOS values that was passed into the read routine was never getting updated. GCC 7.1 gives a warning on this: error: may be used uninitialized in this function Change-Id: I2f7c9b6455761a38598467b001efb0603fd14c32 Signed-off-by: Martin Roth Reviewed-on: https://review.coreboot.org/20700 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Kyösti Mälkki Reviewed-by: Patrick Georgi --- src/soc/dmp/vortex86ex/southbridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/soc/dmp/vortex86ex/southbridge.c b/src/soc/dmp/vortex86ex/southbridge.c index 451aea67c0..1d3c897103 100644 --- a/src/soc/dmp/vortex86ex/southbridge.c +++ b/src/soc/dmp/vortex86ex/southbridge.c @@ -457,14 +457,14 @@ static void read_cmos_rtc(u8 rtc[7]) { /* Read RTC twice and check update-in-progress flag, to make * sure RTC is correct */ - u8 rtc_old[7], rtc_new[7]; + u8 rtc_new[7]; while (get_rtc_update_in_progress()) ; unsafe_read_cmos_rtc(rtc_new); do { - memcpy(rtc_old, rtc_new, 7); + memcpy(rtc, rtc_new, 7); while (get_rtc_update_in_progress()) ; unsafe_read_cmos_rtc(rtc_new); - } while (memcmp(rtc_new, rtc_old, 7) != 0); + } while (memcmp(rtc_new, rtc, 7) != 0); } /*