Return an error code rather than ENXIO when both rman_init() and
rman_manage_region() failed. Reviewed by: marcel
This commit is contained in:
parent
57deb21ad4
commit
bda386db88
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179746
@ -160,7 +160,7 @@ grackle_attach(device_t dev)
|
||||
phandle_t node;
|
||||
u_int32_t busrange[2];
|
||||
struct grackle_range *rp, *io, *mem[2];
|
||||
int nmem, i;
|
||||
int nmem, i, error;
|
||||
|
||||
node = nexus_get_node(dev);
|
||||
sc = device_get_softc(dev);
|
||||
@ -220,8 +220,7 @@ grackle_attach(device_t dev)
|
||||
if (rman_init(&sc->sc_io_rman) != 0 ||
|
||||
rman_manage_region(&sc->sc_io_rman, io->pci_lo,
|
||||
io->pci_lo + io->size_lo) != 0) {
|
||||
device_printf(dev, "failed to set up io range management\n");
|
||||
return (ENXIO);
|
||||
panic("grackle_attach: failed to set up I/O rman");
|
||||
}
|
||||
|
||||
if (nmem == 0) {
|
||||
@ -230,17 +229,18 @@ grackle_attach(device_t dev)
|
||||
}
|
||||
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
|
||||
sc->sc_mem_rman.rm_descr = "Grackle PCI Memory";
|
||||
if (rman_init(&sc->sc_mem_rman) != 0) {
|
||||
device_printf(dev,
|
||||
"failed to init mem range resources\n");
|
||||
return (ENXIO);
|
||||
error = rman_init(&sc->sc_mem_rman);
|
||||
if (error) {
|
||||
device_printf(dev, "rman_init() failed. error = %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
for (i = 0; i < nmem; i++) {
|
||||
if (rman_manage_region(&sc->sc_mem_rman, mem[i]->pci_lo,
|
||||
mem[i]->pci_lo + mem[i]->size_lo) != 0) {
|
||||
device_printf(dev,
|
||||
"failed to set up memory range management\n");
|
||||
return (ENXIO);
|
||||
error = rman_manage_region(&sc->sc_mem_rman, mem[i]->pci_lo,
|
||||
mem[i]->pci_lo + mem[i]->size_lo);
|
||||
if (error) {
|
||||
device_printf(dev,
|
||||
"rman_manage_region() failed. error = %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ macio_attach(device_t dev)
|
||||
phandle_t subchild;
|
||||
device_t cdev;
|
||||
u_int reg[3];
|
||||
int quirks;
|
||||
int error, quirks;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
root = sc->sc_node = OF_finddevice("mac-io");
|
||||
@ -285,12 +285,17 @@ macio_attach(device_t dev)
|
||||
|
||||
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
|
||||
sc->sc_mem_rman.rm_descr = "MacIO Device Memory";
|
||||
if (rman_init(&sc->sc_mem_rman) != 0) {
|
||||
device_printf(dev,
|
||||
"failed to init mem range resources\n");
|
||||
return (ENXIO);
|
||||
error = rman_init(&sc->sc_mem_rman);
|
||||
if (error) {
|
||||
device_printf(dev, "rman_init() failed. error = %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
error = rman_manage_region(&sc->sc_mem_rman, 0, sc->sc_size);
|
||||
if (error) {
|
||||
device_printf(dev,
|
||||
"rman_manage_region() failed. error = %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
rman_manage_region(&sc->sc_mem_rman, 0, sc->sc_size);
|
||||
|
||||
/*
|
||||
* Iterate through the sub-devices
|
||||
|
@ -151,7 +151,7 @@ uninorth_attach(device_t dev)
|
||||
phandle_t child;
|
||||
u_int32_t reg[2], busrange[2];
|
||||
struct uninorth_range *rp, *io, *mem[2];
|
||||
int nmem, i;
|
||||
int nmem, i, error;
|
||||
|
||||
node = nexus_get_node(dev);
|
||||
sc = device_get_softc(dev);
|
||||
@ -207,8 +207,7 @@ uninorth_attach(device_t dev)
|
||||
if (rman_init(&sc->sc_io_rman) != 0 ||
|
||||
rman_manage_region(&sc->sc_io_rman, io->pci_lo,
|
||||
io->pci_lo + io->size_lo - 1) != 0) {
|
||||
device_printf(dev, "failed to set up io range management\n");
|
||||
return (ENXIO);
|
||||
panic("uninorth_attach: failed to set up I/O rman");
|
||||
}
|
||||
|
||||
if (nmem == 0) {
|
||||
@ -217,17 +216,18 @@ uninorth_attach(device_t dev)
|
||||
}
|
||||
sc->sc_mem_rman.rm_type = RMAN_ARRAY;
|
||||
sc->sc_mem_rman.rm_descr = "UniNorth PCI Memory";
|
||||
if (rman_init(&sc->sc_mem_rman) != 0) {
|
||||
device_printf(dev,
|
||||
"failed to init mem range resources\n");
|
||||
return (ENXIO);
|
||||
error = rman_init(&sc->sc_mem_rman);
|
||||
if (error) {
|
||||
device_printf(dev, "rman_init() failed. error = %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
for (i = 0; i < nmem; i++) {
|
||||
if (rman_manage_region(&sc->sc_mem_rman, mem[i]->pci_lo,
|
||||
mem[i]->pci_lo + mem[i]->size_lo - 1) != 0) {
|
||||
error = rman_manage_region(&sc->sc_mem_rman, mem[i]->pci_lo,
|
||||
mem[i]->pci_lo + mem[i]->size_lo - 1);
|
||||
if (error) {
|
||||
device_printf(dev,
|
||||
"failed to set up memory range management\n");
|
||||
return (ENXIO);
|
||||
"rman_manage_region() failed. error = %d\n", error);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user