Re: netapp api init bug


Erwin Rol
 

Hey Jukka,

I opened a PR with a fix;

https://github.com/zephyrproject-rtos/zephyr/pull/676

- Erwin

On 3-7-2017 11:22, Jukka Rissanen wrote:
Hi Erwin,

On Sun, 2017-07-02 at 14:19 +0200, Erwin Rol wrote:
Hallo All,

in zephyr/subsys/net/lib/app/init.c the following piece of code;

int net_app_init(const char *app_info, u32_t flags, s32_t timeout)
{
#define LOOP_DEVIDER 10
struct net_if *iface = net_if_get_default();
int loop = timeout / LOOP_DEVIDER;
int count = 0;

if (app_info) {
NET_INFO("%s", app_info);
}

if (flags & NET_APP_NEED_IPV6) {
count++;
}

if (flags & NET_APP_NEED_IPV4) {
count++;
}

k_sem_init(&counter, count, count);



causes and assert in k_sem_init when neither NET_APP_NEED_IPV6 or
NET_APP_NEED_IPV4 are selected, because count will be 0 and the sem
limit, 3rd arg of k_sem_init, is not allowed to be 0.
Indeed, can you send a fix for this?



And shouldn't it be LOOP_DIVIDER instead of LOOP_DEVIDER?
Yes, there is a typo here.


- Erwin
Cheers,
Jukka

Join devel@lists.zephyrproject.org to automatically receive all group messages.