aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/net/usb_ethernet.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/net/usb_ethernet.c')
-rw-r--r--sys/dev/usb/net/usb_ethernet.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c
index 6025412ebc9c..692ea64128b9 100644
--- a/sys/dev/usb/net/usb_ethernet.c
+++ b/sys/dev/usb/net/usb_ethernet.c
@@ -220,11 +220,6 @@ ue_attach_post_task(struct usb_proc_msg *_task)
error = 0;
CURVNET_SET_QUIET(vnet0);
ifp = if_alloc(IFT_ETHER);
- if (ifp == NULL) {
- device_printf(ue->ue_dev, "could not allocate ifnet\n");
- goto fail;
- }
-
if_setsoftc(ifp, ue);
if_initname(ifp, "ue", ue->ue_unit);
if (ue->ue_methods->ue_attach_post_sub != NULL) {
@@ -320,11 +315,9 @@ uether_ifdetach(struct usb_ether *ue)
ether_ifdetach(ifp);
/* detach miibus */
- if (ue->ue_miibus != NULL) {
- bus_topo_lock();
- device_delete_child(ue->ue_dev, ue->ue_miibus);
- bus_topo_unlock();
- }
+ bus_topo_lock();
+ bus_generic_detach(ue->ue_dev);
+ bus_topo_unlock();
/* free interface instance */
if_free(ifp);
@@ -600,7 +593,14 @@ uether_rxmbuf(struct usb_ether *ue, struct mbuf *m,
/* finalize mbuf */
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = m->m_len = len;
+ if (len != 0) {
+ /*
+ * This is going to get it wrong for an mbuf chain, so let's
+ * make sure we're not doing that.
+ */
+ MPASS(m->m_next == NULL);
+ m->m_pkthdr.len = m->m_len = len;
+ }
/* enqueue for later when the lock can be released */
(void)mbufq_enqueue(&ue->ue_rxq, m);