net: config: fix checking for protocols being ready

With current design there is single semaphore (called 'waiter') for
wakeing up initialization thread. This thread should then check for
number of protocols that still need to be initialized. This happens now
only when waiting on 'waiter' semaphore times out.

Do not check for k_sem_take(&waiter) return value, as all needed
information about protocols being initialized already is in 'counter'
semaphore.

Fixes: #25358

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
Marcin Niestroj 2020-05-15 14:45:30 +02:00 committed by Jukka Rissanen
commit d241c19b0f

View file

@ -402,12 +402,12 @@ int net_config_init(const char *app_info, uint32_t flags, int32_t timeout)
* to wait multiple events, sleep smaller amounts of data.
*/
while (count--) {
if (k_sem_take(&waiter, K_MSEC(loop))) {
k_sem_take(&waiter, K_MSEC(loop));
if (!k_sem_count_get(&counter)) {
break;
}
}
}
if (!count && timeout) {
NET_ERR("Timeout while waiting network %s", "setup");