From db52134d4799e8dc12c52a478513c5d21c933592 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 19 Mar 2015 12:56:47 -0600 Subject: [PATCH] STM32 RTC lower-half: Fix some errors that cause compilation failures. From shilo.xyz --- arch/arm/src/stm32/stm32_rtc_lowerhalf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c index eb732b16e6..ecc64f47a6 100644 --- a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -169,7 +170,7 @@ static int stm32_rdtime(FAR struct rtc_lowerhalf_s *lower, /* Get the higher resolution time */ - int ret = up_rtc_gettime(&ts); + ret = up_rtc_gettime(&ts); if (ret < 0) { goto errout_with_errno; @@ -180,12 +181,14 @@ static int stm32_rdtime(FAR struct rtc_lowerhalf_s *lower, * compatible. */ - if (!gmtime_r(&ts.tv_sec, (FAR struct tm *)rtctime) + if (!gmtime_r(&ts.tv_sec, (FAR struct tm *)rtctime)) { goto errout_with_errno; } -errout_with_errno; + return OK; + +errout_with_errno: ret = get_errno(); DEBUGASSERT(ret > 0); return -ret; @@ -243,7 +246,7 @@ static int stm32_settime(FAR struct rtc_lowerhalf_s *lower, * rtc_time is cast compatible with struct tm. */ - ts.tv_sec = mktime((FAR const struct tm *)rtctime) + ts.tv_sec = mktime((FAR struct tm *)rtctime); ts.tv_nsec = 0; /* Now set the time (to one second accuracy) */