diff --git a/arch/sim/src/sim/up_rtc.c b/arch/sim/src/sim/up_rtc.c index d119253f6e..b020bb7266 100644 --- a/arch/sim/src/sim/up_rtc.c +++ b/arch/sim/src/sim/up_rtc.c @@ -123,10 +123,11 @@ static bool sim_rtc_havesettime(FAR struct rtc_lowerhalf_s *lower) int up_rtc_initialize(void) { + FAR struct rtc_lowerhalf_s *rtc = &g_sim_rtc; + #ifdef CONFIG_RTC_RPMSG_SERVER - up_rtc_set_lowerhalf(rpmsg_rtc_server_initialize(&g_sim_rtc)); -#else - up_rtc_set_lowerhalf(&g_sim_rtc); + rtc = rpmsg_rtc_server_initialize(rtc); #endif - return rtc_initialize(0, &g_sim_rtc); + up_rtc_set_lowerhalf(rtc); + return rtc_initialize(0, rtc); }