From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935665AbcIGP2a (ORCPT ); Wed, 7 Sep 2016 11:28:30 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33017 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964828AbcIGP2V (ORCPT ); Wed, 7 Sep 2016 11:28:21 -0400 From: Azael Avalos To: Darren Hart , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Azael Avalos Subject: [PATCH 1/2] toshiba_haps: Split ACPI status error check from HDD protection support Date: Wed, 7 Sep 2016 09:28:13 -0600 Message-Id: <20160907152815.5950-2-coproscefalo@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160907152815.5950-1-coproscefalo@gmail.com> References: <20160907152815.5950-1-coproscefalo@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the code checking for the ACPI status is mixed along with the actual HDD protection status check. This patch splits those two checks are 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 --- drivers/platform/x86/toshiba_haps.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/toshiba_haps.c b/drivers/platform/x86/toshiba_haps.c index 7f2afc6..094f3a8 100644 --- a/drivers/platform/x86/toshiba_haps.c +++ b/drivers/platform/x86/toshiba_haps.c @@ -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; } -- 2.9.3