summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2001-02-08 20:44:49 +0000
committermsmith <msmith@FreeBSD.org>2001-02-08 20:44:49 +0000
commitd7530cd6666aab2629a125b10daee4aae79fa149 (patch)
tree4beac167f723b4df9a01db74b23cfed704c4412f /sys
parent4fd931631404328f678c24ab0b2ef0969b352b1a (diff)
downloadFreeBSD-src-d7530cd6666aab2629a125b10daee4aae79fa149.zip
FreeBSD-src-d7530cd6666aab2629a125b10daee4aae79fa149.tar.gz
Free the memory we get from devclass_get_devices and device_get_children.
Submitted by: wpaul
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/pci/pci_cfgreg.c11
-rw-r--r--sys/i386/pci/pci_cfgreg.c11
-rw-r--r--sys/i386/pci/pci_pir.c11
3 files changed, 24 insertions, 9 deletions
diff --git a/sys/amd64/pci/pci_cfgreg.c b/sys/amd64/pci/pci_cfgreg.c
index 408db87..f9396af 100644
--- a/sys/amd64/pci/pci_cfgreg.c
+++ b/sys/amd64/pci/pci_cfgreg.c
@@ -323,7 +323,8 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int
/*
* Scan all the PCI busses/devices looking for this one.
*/
- for (i = 0, busp = pci_devices; i < pci_count; i++, busp++) {
+ irq = 255;
+ for (i = 0, busp = pci_devices; (i < pci_count) && (irq == 255); i++, busp++) {
pci_childcount = 0;
device_get_children(*busp, &pci_children, &pci_childcount);
@@ -335,11 +336,15 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int
printf("pci_cfgintr_search: linked (%x) to configured irq %d at %d:%d:%d\n",
irq, pe->pe_intpin[pin - 1].link,
pci_get_bus(*childp), pci_get_slot(*childp), pci_get_function(*childp));
- return(irq);
+ break;
}
}
+ if (pci_children != NULL)
+ free(pci_children, M_TEMP);
}
- return(255);
+ if (pci_devices != NULL)
+ free(pci_devices, M_TEMP);
+ return(irq);
}
/*
diff --git a/sys/i386/pci/pci_cfgreg.c b/sys/i386/pci/pci_cfgreg.c
index 408db87..f9396af 100644
--- a/sys/i386/pci/pci_cfgreg.c
+++ b/sys/i386/pci/pci_cfgreg.c
@@ -323,7 +323,8 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int
/*
* Scan all the PCI busses/devices looking for this one.
*/
- for (i = 0, busp = pci_devices; i < pci_count; i++, busp++) {
+ irq = 255;
+ for (i = 0, busp = pci_devices; (i < pci_count) && (irq == 255); i++, busp++) {
pci_childcount = 0;
device_get_children(*busp, &pci_children, &pci_childcount);
@@ -335,11 +336,15 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int
printf("pci_cfgintr_search: linked (%x) to configured irq %d at %d:%d:%d\n",
irq, pe->pe_intpin[pin - 1].link,
pci_get_bus(*childp), pci_get_slot(*childp), pci_get_function(*childp));
- return(irq);
+ break;
}
}
+ if (pci_children != NULL)
+ free(pci_children, M_TEMP);
}
- return(255);
+ if (pci_devices != NULL)
+ free(pci_devices, M_TEMP);
+ return(irq);
}
/*
diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c
index 408db87..f9396af 100644
--- a/sys/i386/pci/pci_pir.c
+++ b/sys/i386/pci/pci_pir.c
@@ -323,7 +323,8 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int
/*
* Scan all the PCI busses/devices looking for this one.
*/
- for (i = 0, busp = pci_devices; i < pci_count; i++, busp++) {
+ irq = 255;
+ for (i = 0, busp = pci_devices; (i < pci_count) && (irq == 255); i++, busp++) {
pci_childcount = 0;
device_get_children(*busp, &pci_children, &pci_childcount);
@@ -335,11 +336,15 @@ pci_cfgintr_search(struct PIR_entry *pe, int bus, int device, int matchpin, int
printf("pci_cfgintr_search: linked (%x) to configured irq %d at %d:%d:%d\n",
irq, pe->pe_intpin[pin - 1].link,
pci_get_bus(*childp), pci_get_slot(*childp), pci_get_function(*childp));
- return(irq);
+ break;
}
}
+ if (pci_children != NULL)
+ free(pci_children, M_TEMP);
}
- return(255);
+ if (pci_devices != NULL)
+ free(pci_devices, M_TEMP);
+ return(irq);
}
/*
OpenPOWER on IntegriCloud