Rather than remove the #if guard here, shouldn't it instead be expanded to cover the entire else if (av->network_type == RXE_NETWORK_TYPE_IPV6) { clause? There is no need to check for RXE_NETWORK_TYPE_IPV6, make assignments to the stack-allocated pointers or call rxe_find_route6() unless CONFIG_IPV6 is true. In fact, if CONFIG_IPV6 is false, as rxe_find_route6 would also return NULL, the else clause to the RXE_NETWORK_TYPE_IPV4 check could instead become a simple return NULL; > On Aug 22, 2022, at 5:23 AM, Guoqing Jiang <guoqing.jiang@xxxxxxxxx> wrote: > > This check is unnecessary since rxe_find_route6 returns NULL if > CONFIG_IPV6 is disabled. > > Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx> > --- > drivers/infiniband/sw/rxe/rxe_net.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c > index c53f4529f098..b0f31f849144 100644 > --- a/drivers/infiniband/sw/rxe/rxe_net.c > +++ b/drivers/infiniband/sw/rxe/rxe_net.c > @@ -113,11 +113,9 @@ static struct dst_entry *rxe_find_route(struct net_device *ndev, > saddr6 = &av->sgid_addr._sockaddr_in6.sin6_addr; > daddr6 = &av->dgid_addr._sockaddr_in6.sin6_addr; > dst = rxe_find_route6(ndev, saddr6, daddr6); > -#if IS_ENABLED(CONFIG_IPV6) > if (dst) > qp->dst_cookie = > rt6_get_cookie((struct rt6_info *)dst); > -#endif > } > > if (dst && (qp_type(qp) == IB_QPT_RC)) { > -- > 2.31.1 >