net: config: fix timeout 0 blocking start-up
With timeout==0 count is set to 0 as well and then it is decremented to -1. It is later checked == 0 and continues to decrement and loop. Signed-off-by: Markus Becker <markus.becker@tridonic.com>
This commit is contained in:
parent
f756b79124
commit
dc4ce4edbe
1 changed files with 2 additions and 2 deletions
|
@ -359,7 +359,7 @@ int net_config_init(const char *app_info, uint32_t flags, int32_t timeout)
|
|||
if (check_interface(iface) == false) {
|
||||
k_sem_init(&counter, 1, UINT_MAX);
|
||||
|
||||
while (count--) {
|
||||
while (count-- > 0) {
|
||||
if (!k_sem_count_get(&counter)) {
|
||||
break;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ int net_config_init(const char *app_info, uint32_t flags, int32_t timeout)
|
|||
/* Loop here until we are ready to continue. As we might need
|
||||
* to wait multiple events, sleep smaller amounts of data.
|
||||
*/
|
||||
while (!services_are_ready(flags) && count--) {
|
||||
while (!services_are_ready(flags) && count-- > 0) {
|
||||
k_sem_take(&waiter, K_MSEC(loop));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue