[patch] incorrect state check?

Matthew Dobson (colpatch@us.ibm.com)
Tue, 24 Jun 2003 16:06:08 -0700


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-7318-1056496579-0001-2
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi swsusp'ers... I've been looking through some software suspend code,
and I think there's an error in acpi_suspend. The code is checking that
we're trying to move into a valid state. The check now reads:

if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3 || ACPI_STATE_S4) {
/* do stuff */
}

This check will always be true, since ACPI_STATE_S4 is defined to be 4.

The attatched patch fixes this bug by putting a 'state == ' in front of
the 'ACPI_STATE_S4'.

Cheers!

-Matt

--=_courier-7318-1056496579-0001-2
Content-Type: text/plain; name="bad_swsusp_state_check.patch"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="bad_swsusp_state_check.patch"

diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.5.73-vanilla/drivers/acpi/sleep/main.c linux-2.5.73-swsusp/drivers/acpi/sleep/main.c
--- linux-2.5.73-vanilla/drivers/acpi/sleep/main.c Sun Jun 22 11:32:30 2003
+++ linux-2.5.73-swsusp/drivers/acpi/sleep/main.c Tue Jun 24 15:58:58 2003
@@ -238,7 +238,7 @@ acpi_suspend (
/* do we have a wakeup address for S2 and S3? */
/* Here, we support only S4BIOS, those we set the wakeup address */
/* S4OS is only supported for now via swsusp.. */
- if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3 || ACPI_STATE_S4) {
+ if (state == ACPI_STATE_S2 || state == ACPI_STATE_S3 || state == ACPI_STATE_S4) {
if (!acpi_wakeup_address)
return AE_ERROR;
acpi_set_firmware_waking_vector((acpi_physical_address) acpi_wakeup_address);

--=_courier-7318-1056496579-0001-2--