diff --git a/net/icmp/icmp_netpoll.c b/net/icmp/icmp_netpoll.c index 7faf19ebee..05d5085464 100644 --- a/net/icmp/icmp_netpoll.c +++ b/net/icmp/icmp_netpoll.c @@ -141,7 +141,7 @@ static uint16_t icmp_poll_eventhandler(FAR struct net_driver_s *dev, if ((flags & NETDEV_DOWN) != 0) { - eventset |= ((POLLHUP | POLLERR) & info->fds->events); + eventset |= (POLLHUP | POLLERR); } /* Awaken the caller of poll() is requested event occurred. */ @@ -217,25 +217,20 @@ int icmp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) * callback processing. */ - cb->flags = 0; + cb->flags = NETDEV_DOWN; cb->priv = (FAR void *)info; cb->event = icmp_poll_eventhandler; - if ((info->fds->events & POLLOUT) != 0) + if ((fds->events & POLLOUT) != 0) { cb->flags |= ICMP_POLL; } - if ((info->fds->events & POLLIN) != 0) + if ((fds->events & POLLIN) != 0) { cb->flags |= ICMP_NEWDATA; } - if ((info->fds->events & (POLLHUP | POLLERR)) != 0) - { - cb->flags |= NETDEV_DOWN; - } - /* Save the reference in the poll info structure as fds private as well * for use during poll teardown as well. */ diff --git a/net/icmpv6/icmpv6_netpoll.c b/net/icmpv6/icmpv6_netpoll.c index 0db21b3dd9..a7c5371b39 100644 --- a/net/icmpv6/icmpv6_netpoll.c +++ b/net/icmpv6/icmpv6_netpoll.c @@ -141,7 +141,7 @@ static uint16_t icmpv6_poll_eventhandler(FAR struct net_driver_s *dev, if ((flags & NETDEV_DOWN) != 0) { - eventset |= ((POLLHUP | POLLERR) & info->fds->events); + eventset |= (POLLHUP | POLLERR); } /* Awaken the caller of poll() is requested event occurred. */ @@ -215,25 +215,20 @@ int icmpv6_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) * callback processing. */ - cb->flags = 0; + cb->flags = NETDEV_DOWN; cb->priv = (FAR void *)info; cb->event = icmpv6_poll_eventhandler; - if ((info->fds->events & POLLOUT) != 0) + if ((fds->events & POLLOUT) != 0) { cb->flags |= ICMPv6_POLL; } - if ((info->fds->events & POLLIN) != 0) + if ((fds->events & POLLIN) != 0) { cb->flags |= ICMPv6_NEWDATA; } - if ((info->fds->events & (POLLHUP | POLLERR)) != 0) - { - cb->flags |= NETDEV_DOWN; - } - /* Save the reference in the poll info structure as fds private as well * for use during poll teardown as well. */