Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148014020
D34628.id104074.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34628.id104074.diff
View Options
Index: sys/dev/axgbe/if_axgbe_pci.c
===================================================================
--- sys/dev/axgbe/if_axgbe_pci.c
+++ sys/dev/axgbe/if_axgbe_pci.c
@@ -394,6 +394,7 @@
device_t dev;
unsigned int ma_lo, ma_hi;
unsigned int reg;
+ int ret;
sc = iflib_get_softc(ctx);
sc->pdata.dev = dev = iflib_get_dev(ctx);
@@ -423,8 +424,10 @@
sc->pdata.vdata = &xgbe_v2b;
/* PCI setup */
- if (bus_alloc_resources(dev, axgbe_pci_mac_spec, mac_res))
- return (ENXIO);
+ if (bus_alloc_resources(dev, axgbe_pci_mac_spec, mac_res)) {
+ ret = (ENXIO);
+ goto free_vlans;
+ }
sc->pdata.xgmac_res = mac_res[0];
sc->pdata.xpcs_res = mac_res[1];
@@ -465,7 +468,8 @@
pdata->mac_addr[5] = (ma_hi >> 8) & 0xff;
if (!XP_GET_BITS(ma_hi, XP_MAC_ADDR_HI, VALID)) {
axgbe_error("Invalid mac address\n");
- return (EINVAL);
+ ret = (EINVAL);
+ goto release_bus_resource;
}
iflib_set_mac(ctx, pdata->mac_addr);
@@ -527,7 +531,8 @@
/* Alloc channels */
if (axgbe_alloc_channels(ctx)) {
axgbe_error("Unable to allocate channel memory\n");
- return (ENOMEM);
+ ret = (ENOMEM);
+ goto release_bus_resource;
}
TASK_INIT(&pdata->service_work, 0, xgbe_service, pdata);
@@ -542,6 +547,16 @@
xgbe_init_timers(pdata);
return (0);
+
+release_bus_resource:
+ /* Release bus resources */
+ bus_release_resources(dev, axgbe_pci_mac_spec, mac_res);
+
+free_vlans:
+ /* Free VLAN bitmap */
+ free(pdata->active_vlans, M_AXGBE);
+
+ return ret;
} /* axgbe_if_attach_pre */
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 16, 5:02 AM (15 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29754736
Default Alt Text
D34628.id104074.diff (1 KB)
Attached To
Mode
D34628: [PATCH] if_axgbe: properly release resource in error case
Attached
Detach File
Event Timeline
Log In to Comment