diff options
author | Nate Lawson <njl@FreeBSD.org> | 2005-03-27 22:38:28 +0000 |
---|---|---|
committer | Nate Lawson <njl@FreeBSD.org> | 2005-03-27 22:38:28 +0000 |
commit | ca2c69c8ef3d518ea6fe03fdc1043cf5f2a11760 (patch) | |
tree | 704b007a615d14b40ea055d5e6f69cc5c597f19f /sys/dev/acpica/acpi_perf.c | |
parent | bc4c8712305297918e54d65ca2f53561cc6e7d0b (diff) | |
download | src-ca2c69c8ef3d518ea6fe03fdc1043cf5f2a11760.tar.gz src-ca2c69c8ef3d518ea6fe03fdc1043cf5f2a11760.zip |
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.
Notes
Notes:
svn path=/head/; revision=144197
Diffstat (limited to 'sys/dev/acpica/acpi_perf.c')
-rw-r--r-- | sys/dev/acpica/acpi_perf.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/acpica/acpi_perf.c b/sys/dev/acpica/acpi_perf.c index b7cd2e77f93b..c5018f8f90ca 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) |