diff options
author | njl <njl@FreeBSD.org> | 2004-04-14 17:58:19 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-04-14 17:58:19 +0000 |
commit | 91b03e909b9d69104acec3d43c33d6a880173efe (patch) | |
tree | 22ea105d167c13f5c232131f8fc3a820998494f9 | |
parent | 4bc8614fcae210794e127f121414fcfa8b85feb3 (diff) | |
download | FreeBSD-src-91b03e909b9d69104acec3d43c33d6a880173efe.zip FreeBSD-src-91b03e909b9d69104acec3d43c33d6a880173efe.tar.gz |
Return an error immediately if asked to switch a non-existent consumer.
-rw-r--r-- | sys/dev/acpica/acpi_powerres.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_powerres.c b/sys/dev/acpica/acpi_powerres.c index c0a4a16..73c20f2 100644 --- a/sys/dev/acpica/acpi_powerres.c +++ b/sys/dev/acpica/acpi_powerres.c @@ -308,6 +308,10 @@ acpi_pwr_switch_consumer(ACPI_HANDLE consumer, int state) ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + /* It's never ok to switch a non-existent consumer. */ + if (consumer == NULL) + return_ACPI_STATUS (AE_NOT_FOUND); + /* Find the consumer */ if ((pc = acpi_pwr_find_consumer(consumer)) == NULL) { if (ACPI_FAILURE(status = acpi_pwr_register_consumer(consumer))) |