From e0a643591dc35243e658b9c5d6f4c724e6b5644f Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Wed, 3 May 2017 10:14:42 +0200 Subject: [PATCH] net/net_if: Do not start TX thread if there is no network interface And print a warning if that happens. This will also avoid to raise an ASSERT on net_if_tx_thread()'s k_poll as this one will be called with no events to work with. Signed-off-by: Tomasz Bursztyka --- subsys/net/ip/net_if.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 7e15e5b54a6..3b991b2484b 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -1673,6 +1673,11 @@ void net_if_init(struct k_sem *startup_sync) #endif } + if (iface == __net_if_start) { + NET_WARN("There is no network interface to work with!"); + return; + } + k_thread_spawn(tx_stack, sizeof(tx_stack), (k_thread_entry_t)net_if_tx_thread, startup_sync, NULL, NULL, K_PRIO_COOP(7),