]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ACPICA: Fix possible fault for methods that optionally have no return value.
authorBob Moore <robert.moore@intel.com>
Thu, 8 Aug 2013 07:29:38 +0000 (15:29 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 Aug 2013 11:10:36 +0000 (13:10 +0200)
Currently applies to the _WAK method only. If the method has no return
value and slack mode is not enabled, the return value validation code
can fault.

Also improves the error message when an expected return value is
missing (for any predefined name/method).

The problem fixed here cannot happen on Linux unless acpi=strict is
added to the kernel command line.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/nspredef.c

index 24b71a01bf9398340c6c01f68c990ac7caa8c51f..098e7666cbc9450ecae2a92fa605425b3346b9c3 100644 (file)
@@ -150,6 +150,15 @@ acpi_ns_check_return_value(struct acpi_namespace_node *node,
                goto exit;
        }
 
+       /*
+        *
+        * 4) If there is no return value and it is optional, just return
+        * AE_OK (_WAK).
+        */
+       if (!(*return_object_ptr)) {
+               goto exit;
+       }
+
        /*
         * For returned Package objects, check the type of all sub-objects.
         * Note: Package may have been newly created by call above.
@@ -268,7 +277,12 @@ acpi_ns_check_object_type(struct acpi_evaluate_info *info,
 
        acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
 
-       if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
+       if (!return_object) {
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
+                                     "Expected return object of type %s",
+                                     type_buffer));
+       } else if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
                ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
                                      info->node_flags,
                                      "Return type mismatch - found %s, expected %s",