diff options
author | mvs <mvs@cvs.openbsd.org> | 2021-01-19 07:31:06 +0000 |
---|---|---|
committer | mvs <mvs@cvs.openbsd.org> | 2021-01-19 07:31:06 +0000 |
commit | ddc65a36b3b31f6b199d43267265c4a3354b8903 (patch) | |
tree | ee6f0851925bd06e8c6519aeab25c8e093216e8b /sys/net | |
parent | a7e19848b4b6fd8f859c8cd0ccf3b8409608de53 (diff) |
tpmr(4): convert ifunit() to if_unit(9)
ok dlg@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_tpmr.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/net/if_tpmr.c b/sys/net/if_tpmr.c index 0ca44047939..e9206e6573d 100644 --- a/sys/net/if_tpmr.c +++ b/sys/net/if_tpmr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tpmr.c,v 1.21 2020/12/12 00:39:07 dlg Exp $ */ +/* $OpenBSD: if_tpmr.c,v 1.22 2021/01/19 07:31:05 mvs Exp $ */ /* * Copyright (c) 2019 The University of Queensland @@ -466,25 +466,21 @@ tpmr_add_port(struct tpmr_softc *sc, const struct ifbreq *req) if (sc->sc_nports >= nitems(sc->sc_ports)) return (ENOSPC); - ifp0 = ifunit(req->ifbr_ifsname); + ifp0 = if_unit(req->ifbr_ifsname); if (ifp0 == NULL) return (EINVAL); - if (ifp0->if_type != IFT_ETHER) - return (EPROTONOSUPPORT); + if (ifp0->if_type != IFT_ETHER) { + error = EPROTONOSUPPORT; + goto put; + } error = ether_brport_isset(ifp0); if (error != 0) - return (error); + goto put; /* let's try */ - ifp0 = if_get(ifp0->if_index); /* get an actual reference */ - if (ifp0 == NULL) { - /* XXX this should never happen */ - return (EINVAL); - } - p = malloc(sizeof(*p), M_DEVBUF, M_WAITOK|M_ZERO|M_CANFAIL); if (p == NULL) { error = ENOMEM; |