platform/x86: toshiba_haps: Split ACPI and HDD protection error handling
authorAzael Avalos <coproscefalo@gmail.com>
Wed, 7 Sep 2016 15:28:13 +0000 (09:28 -0600)
committerDarren Hart <dvhart@linux.intel.com>
Fri, 23 Sep 2016 23:21:05 +0000 (16:21 -0700)
Currently the code checking for the ACPI status is mixed along with
the actual HDD protection status check.

This patch splits those two checks as they are not related, printing
an error string in case the ACPI call failed, and then check for
actual HDD protection status.

Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
drivers/platform/x86/toshiba_haps.c

index 7f2afc6b5eb9539ffb3fb61cc9abdfbd212caacb..094f3a898d910bf1bf75251b7a4fa0c5ec5b8297 100644 (file)
@@ -168,9 +168,13 @@ static int toshiba_haps_available(acpi_handle handle)
         * A non existent device as well as having (only)
         * Solid State Drives can cause the call to fail.
         */
-       status = acpi_evaluate_integer(handle, "_STA", NULL,
-                                      &hdd_present);
-       if (ACPI_FAILURE(status) || !hdd_present) {
+       status = acpi_evaluate_integer(handle, "_STA", NULL, &hdd_present);
+       if (ACPI_FAILURE(status)) {
+               pr_err("ACPI call to query HDD protection failed\n");
+               return 0;
+       }
+
+       if (!hdd_present) {
                pr_info("HDD protection not available or using SSD\n");
                return 0;
        }