From 975e23bf5ed426e03bf4223bd70cc34eed530db7 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 24 Nov 2017 09:06:32 +0800 Subject: [PATCH] bridgeif: Remove redundant port_netif NULL test in bridgeif_send_to_port portif = br->ports[dstport_idx].port_netif; So no need to have NULL test for both br->ports[dstport_idx].port_netif and portif. Signed-off-by: Axel Lin Signed-off-by: Dirk Ziegelmeier --- src/netif/bridgeif.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/netif/bridgeif.c b/src/netif/bridgeif.c index b8be9c9f..ec5a29ea 100644 --- a/src/netif/bridgeif.c +++ b/src/netif/bridgeif.c @@ -252,14 +252,12 @@ bridgeif_send_to_port(bridgeif_private_t *br, struct pbuf *p, u8_t dstport_idx) /* possibly an external port */ if (dstport_idx < br->max_ports) { struct netif *portif = br->ports[dstport_idx].port_netif; - if (br->ports[dstport_idx].port_netif != NULL) { - if ((portif != NULL) && (portif->linkoutput != NULL)) { - /* prevent sending out to rx port */ - if (netif_get_index(portif) != p->if_idx) { - if (netif_is_link_up(portif)) { - LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> flood(%p:%d) -> %d\n", (void *)p, p->if_idx, netif_get_index(portif))); - return portif->linkoutput(portif, p); - } + if ((portif != NULL) && (portif->linkoutput != NULL)) { + /* prevent sending out to rx port */ + if (netif_get_index(portif) != p->if_idx) { + if (netif_is_link_up(portif)) { + LWIP_DEBUGF(BRIDGEIF_FW_DEBUG, ("br -> flood(%p:%d) -> %d\n", (void *)p, p->if_idx, netif_get_index(portif))); + return portif->linkoutput(portif, p); } } }