This is an automated email from the ASF dual-hosted git repository. gnutt pushed a commit to branch pr71 in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit 02a800c93098d16fa06a8b2a2ea32c3f09a3da81 Author: Xiang Xiao <xiaoxi...@xiaomi.com> AuthorDate: Fri Feb 14 17:25:33 2020 +0800 ntpclient: Initialize g_ntpc_daemon at the definition Change-Id: I4dad2e246aca7d30092cf8a4bc8136e90668f134 Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com> --- netutils/ntpclient/ntpclient.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/netutils/ntpclient/ntpclient.c b/netutils/ntpclient/ntpclient.c index dc8cb60..6be1362 100644 --- a/netutils/ntpclient/ntpclient.c +++ b/netutils/ntpclient/ntpclient.c @@ -117,7 +117,12 @@ struct ntpc_daemon_s * limitation is due only to this global data structure. */ -static struct ntpc_daemon_s g_ntpc_daemon; +static struct ntpc_daemon_s g_ntpc_daemon = +{ + NTP_NOT_RUNNING, + SEM_INITIALIZER(0), + -1 +}; /**************************************************************************** * Private Functions @@ -531,15 +536,6 @@ int ntpc_start(void) if (g_ntpc_daemon.state == NTP_NOT_RUNNING || g_ntpc_daemon.state == NTP_STOPPED) { - /* Is this the first time that the NTP daemon has been started? */ - - if (g_ntpc_daemon.state == NTP_NOT_RUNNING) - { - /* Yes... then we will need to initialize the state structure */ - - sem_init(&g_ntpc_daemon.interlock, 0, 0); - } - /* Start the NTP daemon */ g_ntpc_daemon.state = NTP_STARTED;