aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/e1000/if_em.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/e1000/if_em.c')
-rw-r--r--sys/dev/e1000/if_em.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index fb15a3e1f610..b24280dae412 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1102,10 +1102,11 @@ em_if_attach_post(if_ctx_t ctx)
struct adapter *adapter = iflib_get_softc(ctx);
struct e1000_hw *hw = &adapter->hw;
int error = 0;
-
+
/* Setup OS specific network interface */
error = em_setup_interface(ctx);
if (error != 0) {
+ device_printf(adapter->dev, "Interface setup failed: %d\n", error);
goto err_late;
}
@@ -1123,14 +1124,10 @@ em_if_attach_post(if_ctx_t ctx)
INIT_DEBUGOUT("em_if_attach_post: end");
- return (error);
+ return (0);
err_late:
- em_release_hw_control(adapter);
- em_free_pci_resources(ctx);
- em_if_queues_free(ctx);
- free(adapter->mta, M_DEVBUF);
-
+ /* upon attach_post() error, iflib calls _if_detach() to free resources. */
return (error);
}
@@ -1155,6 +1152,8 @@ em_if_detach(if_ctx_t ctx)
em_release_manageability(adapter);
em_release_hw_control(adapter);
em_free_pci_resources(ctx);
+ free(adapter->mta, M_DEVBUF);
+ adapter->mta = NULL;
return (0);
}
@@ -2981,12 +2980,6 @@ em_if_queues_free(if_ctx_t ctx)
free(adapter->rx_queues, M_DEVBUF);
adapter->rx_queues = NULL;
}
-
- em_release_hw_control(adapter);
-
- if (adapter->mta != NULL) {
- free(adapter->mta, M_DEVBUF);
- }
}
/*********************************************************************