Use OF_prop_free instead of direct call to free(9)
Reviewed by: marius
This commit is contained in:
parent
4441bd735f
commit
14131c0ba4
@ -242,14 +242,14 @@ atkbdc_ebus_attach(device_t dev)
|
||||
device_printf(dev,
|
||||
"<%s>: only two children per 8042 supported\n",
|
||||
cname);
|
||||
free(cname, M_OFWPROP);
|
||||
OF_prop_free(cname);
|
||||
continue;
|
||||
}
|
||||
adi = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (adi == NULL) {
|
||||
device_printf(dev, "<%s>: malloc failed\n", cname);
|
||||
free(cname, M_OFWPROP);
|
||||
OF_prop_free(cname);
|
||||
continue;
|
||||
}
|
||||
if (strcmp(cname, "kb_ps2") == 0) {
|
||||
@ -261,7 +261,7 @@ atkbdc_ebus_attach(device_t dev)
|
||||
} else {
|
||||
device_printf(dev, "<%s>: unknown device\n", cname);
|
||||
free(adi, M_ATKBDDEV);
|
||||
free(cname, M_OFWPROP);
|
||||
OF_prop_free(cname);
|
||||
continue;
|
||||
}
|
||||
intr = bus_get_resource_start(dev, SYS_RES_IRQ, adi->rid);
|
||||
@ -270,7 +270,7 @@ atkbdc_ebus_attach(device_t dev)
|
||||
"<%s>: cannot determine interrupt resource\n",
|
||||
cname);
|
||||
free(adi, M_ATKBDDEV);
|
||||
free(cname, M_OFWPROP);
|
||||
OF_prop_free(cname);
|
||||
continue;
|
||||
}
|
||||
resource_list_init(&adi->resources);
|
||||
@ -281,7 +281,7 @@ atkbdc_ebus_attach(device_t dev)
|
||||
cname);
|
||||
resource_list_free(&adi->resources);
|
||||
free(adi, M_ATKBDDEV);
|
||||
free(cname, M_OFWPROP);
|
||||
OF_prop_free(cname);
|
||||
continue;
|
||||
}
|
||||
device_set_ivars(cdev, adi);
|
||||
|
@ -197,7 +197,7 @@ lebuffer_setup_dinfo(device_t dev, phandle_t node)
|
||||
if (slot != -1 && slot != rslot) {
|
||||
device_printf(dev, "<%s>: multiple slots\n",
|
||||
ldi->ldi_obdinfo.obd_name);
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
goto fail;
|
||||
}
|
||||
slot = rslot;
|
||||
@ -205,7 +205,7 @@ lebuffer_setup_dinfo(device_t dev, phandle_t node)
|
||||
resource_list_add(&ldi->ldi_rl, SYS_RES_MEMORY, i, base,
|
||||
base + reg[i].sbr_size, reg[i].sbr_size);
|
||||
}
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
if (slot != sbus_get_slot(dev)) {
|
||||
device_printf(dev, "<%s>: parent and child slot do not match\n",
|
||||
ldi->ldi_obdinfo.obd_name);
|
||||
@ -231,7 +231,7 @@ lebuffer_setup_dinfo(device_t dev, phandle_t node)
|
||||
resource_list_add(&ldi->ldi_rl, SYS_RES_IRQ, i,
|
||||
iv, iv, 1);
|
||||
}
|
||||
free(intr, M_OFWPROP);
|
||||
OF_prop_free(intr);
|
||||
}
|
||||
return (ldi);
|
||||
|
||||
|
@ -165,7 +165,7 @@ central_attach(device_t dev)
|
||||
resource_list_add(&cdi->cdi_rl, SYS_RES_MEMORY, i,
|
||||
reg[i].sbr_offset, reg[i].sbr_offset +
|
||||
reg[i].sbr_size, reg[i].sbr_size);
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
cdev = device_add_child(dev, NULL, -1);
|
||||
if (cdev == NULL) {
|
||||
device_printf(dev, "<%s>: device_add_child failed\n",
|
||||
|
@ -376,7 +376,7 @@ ebus_pci_attach(device_t dev)
|
||||
}
|
||||
}
|
||||
free(sc->sc_rinfo, M_DEVBUF);
|
||||
free(sc->sc_range, M_OFWPROP);
|
||||
OF_prop_free(sc->sc_range);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node)
|
||||
(void)resource_list_add(&edi->edi_rl, SYS_RES_MEMORY, i,
|
||||
start, start + regs[i].size - 1, regs[i].size);
|
||||
}
|
||||
free(regs, M_OFWPROP);
|
||||
OF_prop_free(regs);
|
||||
|
||||
nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs),
|
||||
(void **)&intrs);
|
||||
@ -701,7 +701,7 @@ ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, phandle_t node)
|
||||
(void)resource_list_add(&edi->edi_rl, SYS_RES_IRQ, i, rintr,
|
||||
rintr, 1);
|
||||
}
|
||||
free(intrs, M_OFWPROP);
|
||||
OF_prop_free(intrs);
|
||||
return (edi);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ fhc_attach(device_t dev)
|
||||
device_printf(dev, "board %d, ", board);
|
||||
if (OF_getprop_alloc(node, "board-model", 1, (void **)&name) != -1) {
|
||||
printf("model %s\n", name);
|
||||
free(name, M_OFWPROP);
|
||||
OF_prop_free(name);
|
||||
} else
|
||||
printf("model unknown\n");
|
||||
|
||||
@ -297,7 +297,7 @@ fhc_attach(device_t dev)
|
||||
resource_list_add(&fdi->fdi_rl, SYS_RES_MEMORY, j,
|
||||
reg[j].sbr_offset, reg[j].sbr_offset +
|
||||
reg[j].sbr_size, reg[j].sbr_size);
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
if (central == 1) {
|
||||
i = OF_getprop_alloc(child, "interrupts",
|
||||
sizeof(*intr), (void **)&intr);
|
||||
@ -307,7 +307,7 @@ fhc_attach(device_t dev)
|
||||
resource_list_add(&fdi->fdi_rl,
|
||||
SYS_RES_IRQ, j, iv, iv, 1);
|
||||
}
|
||||
free(intr, M_OFWPROP);
|
||||
OF_prop_free(intr);
|
||||
}
|
||||
}
|
||||
cdev = device_add_child(dev, NULL, -1);
|
||||
|
@ -169,7 +169,7 @@ isa_setup_children(device_t dev, phandle_t parent)
|
||||
*/
|
||||
if (strcmp(name, "8042") == 0) {
|
||||
isa_setup_children(dev, node);
|
||||
free(name, M_OFWPROP);
|
||||
OF_prop_free(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ isa_setup_children(device_t dev, phandle_t parent)
|
||||
if (ofw_isa_pnp_map[i].name == NULL) {
|
||||
device_printf(dev, "no PnP map entry for node "
|
||||
"0x%lx: %s\n", (unsigned long)node, name);
|
||||
free(name, M_OFWPROP);
|
||||
OF_prop_free(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -230,10 +230,10 @@ isa_setup_children(device_t dev, phandle_t parent)
|
||||
}
|
||||
}
|
||||
if (regidx != NULL)
|
||||
free(regidx, M_OFWPROP);
|
||||
OF_prop_free(regidx);
|
||||
}
|
||||
if (regs != NULL)
|
||||
free(regs, M_OFWPROP);
|
||||
OF_prop_free(regs);
|
||||
|
||||
nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs),
|
||||
(void **)&intrs);
|
||||
@ -251,14 +251,14 @@ isa_setup_children(device_t dev, phandle_t parent)
|
||||
bus_set_resource(cdev, SYS_RES_IRQ, i, rintr, 1);
|
||||
}
|
||||
if (intrs != NULL)
|
||||
free(intrs, M_OFWPROP);
|
||||
OF_prop_free(intrs);
|
||||
|
||||
ndrq = OF_getprop_alloc(node, "dma-channel", sizeof(*drqs),
|
||||
(void **)&drqs);
|
||||
for (i = 0; i < ndrq; i++)
|
||||
bus_set_resource(cdev, SYS_RES_DRQ, i, drqs[i], 1);
|
||||
if (drqs != NULL)
|
||||
free(drqs, M_OFWPROP);
|
||||
OF_prop_free(drqs);
|
||||
|
||||
/*
|
||||
* Devices using DMA hang off of the `dma' node instead of
|
||||
@ -267,7 +267,7 @@ isa_setup_children(device_t dev, phandle_t parent)
|
||||
if (strcmp(name, "dma") == 0)
|
||||
isa_setup_children(dev, node);
|
||||
|
||||
free(name, M_OFWPROP);
|
||||
OF_prop_free(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,12 +100,12 @@ ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat, u_long iosize,
|
||||
if (sc->sc_pci_bh[j] != 0) {
|
||||
device_printf(dev, "duplicate range for space %d\n",
|
||||
j);
|
||||
free(range, M_OFWPROP);
|
||||
OF_prop_free(range);
|
||||
return (EINVAL);
|
||||
}
|
||||
sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]);
|
||||
}
|
||||
free(range, M_OFWPROP);
|
||||
OF_prop_free(range);
|
||||
|
||||
/*
|
||||
* Make sure that the expected ranges are actually present.
|
||||
|
@ -216,7 +216,7 @@ dma_attach(device_t dev)
|
||||
csr &= ~E_TP_AUI;
|
||||
else
|
||||
csr |= E_TP_AUI;
|
||||
free(cabletype, M_OFWPROP);
|
||||
OF_prop_free(cabletype);
|
||||
}
|
||||
L64854_SCSR(lsc, csr);
|
||||
DELAY(20000); /* manual says we need a 20ms delay */
|
||||
@ -309,7 +309,7 @@ dma_setup_dinfo(device_t dev, struct dma_softc *dsc, phandle_t node)
|
||||
if (slot != -1 && slot != rslot) {
|
||||
device_printf(dev, "<%s>: multiple slots\n",
|
||||
ddi->ddi_obdinfo.obd_name);
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
goto fail;
|
||||
}
|
||||
slot = rslot;
|
||||
@ -317,7 +317,7 @@ dma_setup_dinfo(device_t dev, struct dma_softc *dsc, phandle_t node)
|
||||
resource_list_add(&ddi->ddi_rl, SYS_RES_MEMORY, i, base,
|
||||
base + reg[i].sbr_size, reg[i].sbr_size);
|
||||
}
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
if (slot != dsc->sc_slot) {
|
||||
device_printf(dev, "<%s>: parent and child slot do not match\n",
|
||||
ddi->ddi_obdinfo.obd_name);
|
||||
@ -343,7 +343,7 @@ dma_setup_dinfo(device_t dev, struct dma_softc *dsc, phandle_t node)
|
||||
resource_list_add(&ddi->ddi_rl, SYS_RES_IRQ, i,
|
||||
iv, iv, 1);
|
||||
}
|
||||
free(intr, M_OFWPROP);
|
||||
OF_prop_free(intr);
|
||||
}
|
||||
return (ddi);
|
||||
|
||||
|
@ -331,7 +331,7 @@ sbus_attach(device_t dev)
|
||||
sc->sc_rd[i].rd_pend = phys + size;
|
||||
sc->sc_rd[i].rd_res = res;
|
||||
}
|
||||
free(range, M_OFWPROP);
|
||||
OF_prop_free(range);
|
||||
|
||||
/*
|
||||
* Get the SBus burst transfer size if burst transfers are supported.
|
||||
@ -495,7 +495,7 @@ sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, phandle_t node)
|
||||
if (slot != -1 && slot != rslot) {
|
||||
device_printf(dev, "<%s>: multiple slots\n",
|
||||
sdi->sdi_obdinfo.obd_name);
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
goto fail;
|
||||
}
|
||||
slot = rslot;
|
||||
@ -503,7 +503,7 @@ sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, phandle_t node)
|
||||
resource_list_add(&sdi->sdi_rl, SYS_RES_MEMORY, i,
|
||||
base, base + reg[i].sbr_size, reg[i].sbr_size);
|
||||
}
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
}
|
||||
sdi->sdi_slot = slot;
|
||||
|
||||
@ -525,7 +525,7 @@ sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, phandle_t node)
|
||||
resource_list_add(&sdi->sdi_rl, SYS_RES_IRQ, i,
|
||||
iv, iv, 1);
|
||||
}
|
||||
free(intr, M_OFWPROP);
|
||||
OF_prop_free(intr);
|
||||
}
|
||||
if (OF_getprop(node, "burst-sizes", &sdi->sdi_burstsz,
|
||||
sizeof(sdi->sdi_burstsz)) == -1)
|
||||
|
@ -559,7 +559,7 @@ nexus_setup_dinfo(device_t dev, phandle_t node)
|
||||
resource_list_add(&ndi->ndi_rl, SYS_RES_MEMORY, i,
|
||||
phys, phys + size - 1, size);
|
||||
}
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
|
||||
nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intr),
|
||||
(void **)&intr);
|
||||
@ -568,7 +568,7 @@ nexus_setup_dinfo(device_t dev, phandle_t node)
|
||||
"upa-portid" : "portid", &ign, sizeof(ign)) <= 0) {
|
||||
device_printf(dev, "<%s>: could not determine portid\n",
|
||||
ndi->ndi_obdinfo.obd_name);
|
||||
free(intr, M_OFWPROP);
|
||||
OF_prop_free(intr);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -579,7 +579,7 @@ nexus_setup_dinfo(device_t dev, phandle_t node)
|
||||
resource_list_add(&ndi->ndi_rl, SYS_RES_IRQ, i, intr[i],
|
||||
intr[i], 1);
|
||||
}
|
||||
free(intr, M_OFWPROP);
|
||||
OF_prop_free(intr);
|
||||
}
|
||||
|
||||
return (ndi);
|
||||
|
@ -560,7 +560,7 @@ upa_setup_dinfo(device_t dev, struct upa_softc *sc, phandle_t node,
|
||||
for (i = 0; i < nreg; i++)
|
||||
resource_list_add(&udi->udi_rl, SYS_RES_MEMORY, i, reg[i].phys,
|
||||
reg[i].phys + reg[i].size - 1, reg[i].size);
|
||||
free(reg, M_OFWPROP);
|
||||
OF_prop_free(reg);
|
||||
|
||||
intr = INTMAP_VEC(sc->sc_ign, (UPA_INO_BASE + portid));
|
||||
resource_list_add(&udi->udi_rl, SYS_RES_IRQ, 0, intr, intr, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user