Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109397907
D35681.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
D35681.diff
View Options
diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c
--- a/sys/dev/ofw/ofw_pcib.c
+++ b/sys/dev/ofw/ofw_pcib.c
@@ -211,7 +211,7 @@
error = rman_init(&sc->sc_mem_rman);
if (error != 0) {
device_printf(dev, "rman_init() failed. error = %d\n", error);
- goto out;
+ goto out_mem_rman;
}
sc->sc_pmem_rman.rm_type = RMAN_ARRAY;
@@ -219,7 +219,7 @@
error = rman_init(&sc->sc_pmem_rman);
if (error != 0) {
device_printf(dev, "rman_init() failed. error = %d\n", error);
- goto out;
+ goto out_pmem_rman;
}
for (i = 0; i < sc->sc_nrange; i++) {
@@ -254,21 +254,37 @@
"error = %d\n", rp->pci_hi &
OFW_PCI_PHYS_HI_SPACEMASK, rp->pci,
rp->pci + rp->size - 1, error);
- goto out;
+ goto out_full;
}
}
ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(cell_t));
return (0);
+out_full:
+ rman_fini(&sc->sc_pmem_rman);
+out_pmem_rman:
+ rman_fini(&sc->sc_mem_rman);
+out_mem_rman:
+ rman_fini(&sc->sc_io_rman);
out:
- free(cell_info, M_DEVBUF);
+ free(sc->sc_cell_info, M_DEVBUF);
+ free(sc->sc_range, M_DEVBUF);
+
+ return (error);
+}
+
+void
+ofw_pcib_fini(device_t dev)
+{
+ struct ofw_pci_softc *sc;
+
+ sc = device_get_softc(dev);
+ free(sc->sc_cell_info, M_DEVBUF);
free(sc->sc_range, M_DEVBUF);
rman_fini(&sc->sc_io_rman);
rman_fini(&sc->sc_mem_rman);
rman_fini(&sc->sc_pmem_rman);
-
- return (error);
}
int
diff --git a/sys/dev/ofw/ofwpci.h b/sys/dev/ofw/ofwpci.h
--- a/sys/dev/ofw/ofwpci.h
+++ b/sys/dev/ofw/ofwpci.h
@@ -78,6 +78,7 @@
};
int ofw_pcib_init(device_t);
+void ofw_pcib_fini(device_t);
int ofw_pcib_attach(device_t);
int ofw_pcib_read_ivar(device_t, device_t, int, uintptr_t *);
int ofw_pcib_write_ivar(device_t, device_t, int, uintptr_t);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Feb 5, 1:20 PM (7 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16474954
Default Alt Text
D35681.diff (1 KB)
Attached To
Mode
D35681: Fix ofw pcib when it rman_init fails
Attached
Detach File
Event Timeline
Log In to Comment