diff --git a/net/mld/mld_group.c b/net/mld/mld_group.c index 799aa29f16..6e8dac795f 100644 --- a/net/mld/mld_group.c +++ b/net/mld/mld_group.c @@ -91,7 +91,7 @@ static int mld_ngroups(FAR struct net_driver_s *dev) * needed. */ - return ngroups - 1; + return ngroups > 0 ? ngroups - 1 : 0; } /**************************************************************************** @@ -147,12 +147,12 @@ FAR struct mld_group_s *mld_grpalloc(FAR struct net_driver_s *dev, group->ifindex = dev->d_ifindex; -#ifndef CONFIG_CONFIG_NET_MLD_ROUTER +#ifndef CONFIG_NET_MLD_ROUTER /* Start the query timer if we are the Querier and this is the first * group member of the group. */ - if (mld_ngroups(dev) < 1) + if (mld_ngroups(dev) == 0) { mld_start_gentimer(dev, MSEC2TICK(MLD_QUERY_MSEC)); } @@ -271,12 +271,12 @@ void mld_grpfree(FAR struct net_driver_s *dev, FAR struct mld_group_s *group) mldinfo("Call sched_kfree()\n"); kmm_free(group); -#ifndef CONFIG_CONFIG_NET_MLD_ROUTER +#ifndef CONFIG_NET_MLD_ROUTER /* If there are no longer any groups, then stop the general query and v1 * compatibility timers. */ - if (mld_ngroups(dev) < 1) + if (mld_ngroups(dev) == 0) { wd_cancel(dev->d_mld.gendog); wd_cancel(dev->d_mld.v1dog); diff --git a/net/mld/mld_initialize.c b/net/mld/mld_initialize.c index cfe3b1f381..c9ef9caae1 100644 --- a/net/mld/mld_initialize.c +++ b/net/mld/mld_initialize.c @@ -105,7 +105,7 @@ void mld_devinit(struct net_driver_s *dev) mld_addmcastmac(dev, g_ipv6_allrouters); mld_addmcastmac(dev, g_ipv6_allmldv2routers); -#ifdef CONFIG_CONFIG_NET_MLD_ROUTER +#ifdef CONFIG_NET_MLD_ROUTER /* Start the general query timer. */ mld_start_gentimer(dev, MSEC2TICK(MLD_QUERY_MSEC));