Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142291393
D27634.id83232.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D27634.id83232.diff
View Options
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -1102,10 +1102,11 @@
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 @@
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_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 @@
free(adapter->rx_queues, M_DEVBUF);
adapter->rx_queues = NULL;
}
-
- em_release_hw_control(adapter);
-
- if (adapter->mta != NULL) {
- free(adapter->mta, M_DEVBUF);
- }
}
/*********************************************************************
diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c
--- a/sys/dev/ixl/if_ixl.c
+++ b/sys/dev/ixl/if_ixl.c
@@ -1253,7 +1253,7 @@
struct ixl_pf *pf = iflib_get_softc(ctx);
struct ixl_vsi *vsi = &pf->vsi;
- if (!vsi->enable_head_writeback) {
+ if (vsi->tx_queues != NULL && !vsi->enable_head_writeback) {
struct ixl_tx_queue *que;
int i = 0;
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -4900,7 +4900,7 @@
device_printf(dev,
"Cannot use iflib with only 1 MSI-X interrupt!\n");
err = ENODEV;
- goto fail_intr_free;
+ goto fail_queues;
}
ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac.octet);
@@ -4936,13 +4936,14 @@
fail_detach:
ether_ifdetach(ctx->ifc_ifp);
-fail_intr_free:
- iflib_free_intr_mem(ctx);
fail_queues:
+ iflib_tqg_detach(ctx);
iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);
- iflib_tqg_detach(ctx);
IFDI_DETACH(ctx);
+ IFDI_QUEUES_FREE(ctx);
+fail_intr_free:
+ iflib_free_intr_mem(ctx);
fail_unlock:
CTX_UNLOCK(ctx);
iflib_deregister(ctx);
@@ -5139,11 +5140,12 @@
fail_detach:
ether_ifdetach(ctx->ifc_ifp);
fail_queues:
+ iflib_tqg_detach(ctx);
iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);
- iflib_tqg_detach(ctx);
fail_iflib_detach:
IFDI_DETACH(ctx);
+ IFDI_QUEUES_FREE(ctx);
fail_unlock:
CTX_UNLOCK(ctx);
iflib_deregister(ctx);
@@ -5173,6 +5175,8 @@
iflib_tqg_detach(ctx);
iflib_tx_structures_free(ctx);
iflib_rx_structures_free(ctx);
+ IFDI_DETACH(ctx);
+ IFDI_QUEUES_FREE(ctx);
iflib_deregister(ctx);
@@ -5233,8 +5237,12 @@
led_destroy(ctx->ifc_led_dev);
iflib_tqg_detach(ctx);
+ iflib_tx_structures_free(ctx);
+ iflib_rx_structures_free(ctx);
+
CTX_LOCK(ctx);
IFDI_DETACH(ctx);
+ IFDI_QUEUES_FREE(ctx);
CTX_UNLOCK(ctx);
/* ether_ifdetach calls if_qflush - lock must be destroy afterwards*/
@@ -5242,9 +5250,6 @@
bus_generic_detach(dev);
- iflib_tx_structures_free(ctx);
- iflib_rx_structures_free(ctx);
-
iflib_deregister(ctx);
device_set_softc(ctx->ifc_dev, NULL);
@@ -5828,7 +5833,6 @@
}
free(ctx->ifc_txqs, M_IFLIB);
ctx->ifc_txqs = NULL;
- IFDI_QUEUES_FREE(ctx);
}
/*********************************************************************
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 6:06 AM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27733429
Default Alt Text
D27634.id83232.diff (3 KB)
Attached To
Mode
D27634: Ensure to free memory and pci resources in order
Attached
Detach File
Event Timeline
Log In to Comment