From 46d0f824bec21e582b8b0df2fc6f124eff6aac18 Mon Sep 17 00:00:00 2001 From: Matt Macy Date: Sat, 19 May 2018 05:27:49 +0000 Subject: [PATCH] net: fix set but not used --- sys/net/if_clone.c | 2 +- sys/net/if_epair.c | 6 +++--- sys/net/if_lagg.c | 5 +---- sys/net/if_stf.c | 2 +- sys/net/if_vxlan.c | 9 +++++---- sys/net/iflib.c | 7 +------ 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c index 9b33a4ee515b..4951ea99ef73 100644 --- a/sys/net/if_clone.c +++ b/sys/net/if_clone.c @@ -416,7 +416,7 @@ if_clone_simple(const char *name, ifcs_create_t create, ifcs_destroy_t destroy, for (unit = 0; unit < minifs; unit++) { char name[IFNAMSIZ]; - int error; + int error __unused; snprintf(name, IFNAMSIZ, "%s%d", ifc->ifc_name, unit); error = if_clone_createif(ifc, name, IFNAMSIZ, NULL); diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index 07af2a161956..e897431fa0ed 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -251,7 +251,7 @@ static void epair_nh_sintr(struct mbuf *m) { struct ifnet *ifp; - struct epair_softc *sc; + struct epair_softc *sc __unused; ifp = m->m_pkthdr.rcvif; (*ifp->if_input)(ifp, m); @@ -296,7 +296,7 @@ epair_nh_drainedcpu(u_int cpuid) IFQ_LOCK(&ifp->if_snd); if (IFQ_IS_EMPTY(&ifp->if_snd)) { - struct epair_softc *sc; + struct epair_softc *sc __unused; STAILQ_REMOVE(&epair_dpcpu->epair_ifp_drain_list, elm, epair_ifp_drain, ifp_next); @@ -337,7 +337,7 @@ epair_remove_ifp_from_draining(struct ifnet *ifp) STAILQ_FOREACH_SAFE(elm, &epair_dpcpu->epair_ifp_drain_list, ifp_next, tvar) { if (ifp == elm->ifp) { - struct epair_softc *sc; + struct epair_softc *sc __unused; STAILQ_REMOVE( &epair_dpcpu->epair_ifp_drain_list, elm, diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 4fc28d789d9a..c418b6986194 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -1641,10 +1641,7 @@ static int lagg_transmit(struct ifnet *ifp, struct mbuf *m) { struct lagg_softc *sc = (struct lagg_softc *)ifp->if_softc; - int error, len, mcast; - - len = m->m_pkthdr.len; - mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; + int error; LAGG_RLOCK(); /* We need a Tx algorithm and at least one port */ diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 37d1984b7830..b10202076d02 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -272,7 +272,7 @@ static int stf_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) { struct stf_softc *sc = ifp->if_softc; - int err; + int err __unused; err = encap_detach(sc->encap_cookie); KASSERT(err == 0, ("Unexpected error detaching encap_cookie")); diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 53be5af62b10..1dd530272ba1 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -588,7 +588,7 @@ vxlan_ftable_update_locked(struct vxlan_softc *sc, struct rm_priotracker *tracker) { struct vxlan_ftable_entry *fe; - int error; + int error __unused; VXLAN_LOCK_ASSERT(sc); @@ -863,8 +863,9 @@ static void vxlan_socket_destroy(struct vxlan_socket *vso) { struct socket *so; - struct vxlan_socket_mc_info *mc; +#ifdef INVARIANTS int i; + struct vxlan_socket_mc_info *mc; for (i = 0; i < VXLAN_SO_MC_MAX_GROUPS; i++) { mc = &vso->vxlso_mc[i]; @@ -878,7 +879,7 @@ vxlan_socket_destroy(struct vxlan_socket *vso) ("%s: socket %p vni_hash[%d] not empty", __func__, vso, i)); } - +#endif so = vso->vxlso_sock; if (so != NULL) { vso->vxlso_sock = NULL; @@ -2505,7 +2506,7 @@ vxlan_rcv_udp_packet(struct mbuf *m, int offset, struct inpcb *inpcb, struct vxlan_socket *vso; struct vxlan_header *vxh, vxlanhdr; uint32_t vni; - int error; + int error __unused; M_ASSERTPKTHDR(m); vso = xvso; diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 1070eb1ab04b..7a5583dbe5e7 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1270,7 +1270,6 @@ static void iflib_gen_mac(if_ctx_t ctx) { struct thread *td; - struct ifnet *ifp; MD5_CTX mdctx; char uuid[HOSTUUIDLEN+1]; char buf[HOSTUUIDLEN+16]; @@ -1278,7 +1277,6 @@ iflib_gen_mac(if_ctx_t ctx) unsigned char digest[16]; td = curthread; - ifp = ctx->ifc_ifp; mac = ctx->ifc_mac; uuid[HOSTUUIDLEN] = 0; bcopy(td->td_ucred->cr_prison->pr_hostuuid, uuid, HOSTUUIDLEN); @@ -4281,10 +4279,7 @@ iflib_reset_qvalues(if_ctx_t ctx) if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; if_shared_ctx_t sctx = ctx->ifc_sctx; device_t dev = ctx->ifc_dev; - int i, main_txq, main_rxq; - - main_txq = (sctx->isc_flags & IFLIB_HAS_TXCQ) ? 1 : 0; - main_rxq = (sctx->isc_flags & IFLIB_HAS_RXCQ) ? 1 : 0; + int i; scctx->isc_txrx_budget_bytes_max = IFLIB_MAX_TX_BYTES; scctx->isc_tx_qdepth = IFLIB_DEFAULT_TX_QDEPTH;