Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi When setting the power, always mark the state a...



details:   https://anonhg.NetBSD.org/src/rev/a4c18dc73672
branches:  trunk
changeset: 754196:a4c18dc73672
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Apr 23 15:20:35 2010 +0000

description:
When setting the power, always mark the state as invalid on failure, even if
going to D0. Also fix a potential NULL pointer dereference in an aprint_().

diffstat:

 sys/dev/acpi/acpi_power.c |  23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diffs (53 lines):

diff -r 377b2e2e6447 -r a4c18dc73672 sys/dev/acpi/acpi_power.c
--- a/sys/dev/acpi/acpi_power.c Fri Apr 23 15:19:19 2010 +0000
+++ b/sys/dev/acpi/acpi_power.c Fri Apr 23 15:20:35 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.1 2010/04/22 18:40:09 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.2 2010/04/23 15:20:35 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.1 2010/04/22 18:40:09 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.2 2010/04/23 15:20:35 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -423,21 +423,12 @@
        return true;
 
 fail:
-       /*
-        * It is never an error to go to D0.
-        */
-       if (state != ACPI_STATE_D0) {
+       ad->ad_state = ACPI_STATE_ERROR;
 
-               aprint_error_dev(ad->ad_root,
-                   "failed to set power state to D%d for %s: %s\n",
-                   state, ad->ad_name, AcpiFormatException(rv));
+       aprint_error_dev(ad->ad_root, "failed to set power state to D%d "
+           "for %s: %s\n", state, ad->ad_name, AcpiFormatException(rv));
 
-               ad->ad_state = ACPI_STATE_ERROR;
-
-               return false;
-       }
-
-       return true;
+       return false;
 }
 
 /*
@@ -459,7 +450,7 @@
        }
 
        aprint_error_dev(sc->sc_dev, "%s: failed to "
-           "find node %s\n", __func__, ad->ad_name);
+           "find node %s\n", __func__, acpi_xname(hdl));
 
        return false;
 }



Home | Main Index | Thread Index | Old Index