summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_perf.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-03-27 22:38:28 +0000
committernjl <njl@FreeBSD.org>2005-03-27 22:38:28 +0000
commit225da24b06256ad94361f2d6a1ef39a5b4a398ed (patch)
tree704b007a615d14b40ea055d5e6f69cc5c597f19f /sys/dev/acpica/acpi_perf.c
parent08fabe830f7538db39f3c55544925b884b6aae3e (diff)
downloadFreeBSD-src-225da24b06256ad94361f2d6a1ef39a5b4a398ed.zip
FreeBSD-src-225da24b06256ad94361f2d6a1ef39a5b4a398ed.tar.gz
Clean up resources properly if acpi_perf fails to attach. First, change
acpi_bus_alloc_gas() to delete the resource it set if alloc fails. Then, change acpi_perf to delete the resource after releasing it if alloc fails. This should make probe and attach both fully restartable if either fails.
Diffstat (limited to 'sys/dev/acpica/acpi_perf.c')
-rw-r--r--sys/dev/acpica/acpi_perf.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c
index b7cd2e7..c5018f8 100644
--- a/sys/dev/acpica/acpi_perf.c
+++ b/sys/dev/acpica/acpi_perf.c
@@ -196,6 +196,7 @@ acpi_perf_probe(device_t dev)
switch (error) {
case 0:
bus_release_resource(dev, type, rid, res);
+ bus_delete_resource(dev, type, rid);
device_set_desc(dev, "ACPI CPU Frequency Control");
break;
case EOPNOTSUPP:
@@ -354,8 +355,23 @@ acpi_perf_evaluate(device_t dev)
out:
if (error) {
- if (sc->px_states)
+ if (sc->px_states) {
free(sc->px_states, M_ACPIPERF);
+ sc->px_states = NULL;
+ }
+ if (sc->perf_ctrl) {
+ bus_release_resource(sc->dev, sc->perf_ctrl_type, 0,
+ sc->perf_ctrl);
+ bus_delete_resource(sc->dev, sc->perf_ctrl_type, 0);
+ sc->perf_ctrl = NULL;
+ }
+ if (sc->perf_status) {
+ bus_release_resource(sc->dev, sc->perf_sts_type, 1,
+ sc->perf_status);
+ bus_delete_resource(sc->dev, sc->perf_sts_type, 1);
+ sc->perf_status = NULL;
+ }
+ sc->px_rid = 0;
sc->px_count = 0;
}
if (buf.Pointer)
OpenPOWER on IntegriCloud