api_lib: fix duplicate NULL check with sys_sem_valid()

This commit is contained in:
Simon Goldschmidt 2019-07-10 21:55:28 +02:00 committed by Erik Ekman
parent ed6c951a19
commit f1bd63046e

View File

@ -1346,7 +1346,7 @@ void
netconn_thread_init(void) netconn_thread_init(void)
{ {
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET(); sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
if ((sem == NULL) || !sys_sem_valid(sem)) { if (!sys_sem_valid(sem)) {
/* call alloc only once */ /* call alloc only once */
LWIP_NETCONN_THREAD_SEM_ALLOC(); LWIP_NETCONN_THREAD_SEM_ALLOC();
LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC() failed", sys_sem_valid(LWIP_NETCONN_THREAD_SEM_GET())); LWIP_ASSERT("LWIP_NETCONN_THREAD_SEM_ALLOC() failed", sys_sem_valid(LWIP_NETCONN_THREAD_SEM_GET()));
@ -1357,7 +1357,7 @@ void
netconn_thread_cleanup(void) netconn_thread_cleanup(void)
{ {
sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET(); sys_sem_t *sem = LWIP_NETCONN_THREAD_SEM_GET();
if ((sem != NULL) && sys_sem_valid(sem)) { if (sys_sem_valid(sem)) {
/* call free only once */ /* call free only once */
LWIP_NETCONN_THREAD_SEM_FREE(); LWIP_NETCONN_THREAD_SEM_FREE();
} }