From patchwork Fri Jun 17 22:16:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hotran X-Patchwork-Id: 9185087 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3FFC9601C0 for ; Fri, 17 Jun 2016 22:16:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D8B327248 for ; Fri, 17 Jun 2016 22:16:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2107A27F54; Fri, 17 Jun 2016 22:16:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C06F27248 for ; Fri, 17 Jun 2016 22:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752926AbcFQWQu (ORCPT ); Fri, 17 Jun 2016 18:16:50 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:33509 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478AbcFQWQt (ORCPT ); Fri, 17 Jun 2016 18:16:49 -0400 Received: by mail-pf0-f169.google.com with SMTP id i123so30757434pfg.0 for ; Fri, 17 Jun 2016 15:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=K8IMUZaRxGvW2u112b3qrpC5rcqwZjlrRuhFxnSOkPc=; b=MzODFvJZcXfl/ZqEF95tPggLZvXSx2/bB3Yu8b3nC8iz6BzOFHzGvYkFhl2Fx1Jxn5 QWmMfj+f2ADstNKvdAAZvoURyQIc7OxL247wNGbLkugH+0dGcR19oA0FOo+fLn9Bqvqk r51/XlrlArtcyg7SPbI0ERz2kCiu0m8M62b8o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=K8IMUZaRxGvW2u112b3qrpC5rcqwZjlrRuhFxnSOkPc=; b=S7syOETKIronIA/H/OcpApn7eVIyVcgMbPSbolR6QR7KACu8hrK1e1gh3bn4O9Y4yG WVz6KntlHK4z5JXgiWT//EdjzZTGogkfpCNBwXLh7gqkVRGkMRlTHJvTJlumDedqBrJV Ufqb4sRihwLes+yXM6PK0u6RRBdbj3M8hG2WhHciSfXbQEHnmDx1TT4dmnTrDLQ65WXM JB4sASk/6GKfyUmAqpeOB2PDzLR6GJCuLjrPawiYKOZiu2G0muQqNcn/7VwwFhB1Fy9l rnodTKmA9vXQqiYzqQyhA2vPk0ywV3SoQVwhjQpyyXaKeVzFSJ+qRwm4+lKWzlurB5Fx vD9w== X-Gm-Message-State: ALyK8tIqoRlyVbty2Gd1Fb32aPzzAIsmtRCXEpbMpzO281l2guMuVa9zSxQFcK1Mibv1cEbb X-Received: by 10.98.204.130 with SMTP id j2mr4841721pfk.147.1466201808920; Fri, 17 Jun 2016 15:16:48 -0700 (PDT) Received: from hotran_localhost.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id um1sm32800200pac.41.2016.06.17.15.16.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Jun 2016 15:16:48 -0700 (PDT) From: Hoan Tran To: Ashwin Chaugule , "Rafael J. Wysocki" , Len Brown , pprakash@codeaurora.org Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, lho@apm.com, Duc Dang , Hoan Tran Subject: [PATCH] ACPI: CPPC: Return error if _CPC is invalid on a CPU Date: Fri, 17 Jun 2016 15:16:31 -0700 Message-Id: <1466201791-13351-1-git-send-email-hotran@apm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Based on 8.4.7.1 section of ACPI 6.1 specification, if the platform supports CPPC, the _CPC object must exist under all processor objects. If cpc_desc_ptr pointer is invalid on any CPUs, acpi_get_psd_map() should return error and CPPC cpufreq driver can not be registered. Signed-off-by: Hoan Tran Reviewed-by: Prashanth Prakash --- drivers/acpi/cppc_acpi.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 85fd8f7..2e98173 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -299,8 +299,10 @@ int acpi_get_psd_map(struct cpudata **all_cpu_data) continue; cpc_ptr = per_cpu(cpc_desc_ptr, i); - if (!cpc_ptr) - continue; + if (!cpc_ptr) { + retval = -EFAULT; + goto err_ret; + } pdomain = &(cpc_ptr->domain_info); cpumask_set_cpu(i, pr->shared_cpu_map); @@ -322,8 +324,10 @@ int acpi_get_psd_map(struct cpudata **all_cpu_data) continue; match_cpc_ptr = per_cpu(cpc_desc_ptr, j); - if (!match_cpc_ptr) - continue; + if (!match_cpc_ptr) { + retval = -EFAULT; + goto err_ret; + } match_pdomain = &(match_cpc_ptr->domain_info); if (match_pdomain->domain != pdomain->domain) @@ -353,8 +357,10 @@ int acpi_get_psd_map(struct cpudata **all_cpu_data) continue; match_cpc_ptr = per_cpu(cpc_desc_ptr, j); - if (!match_cpc_ptr) - continue; + if (!match_cpc_ptr) { + retval = -EFAULT; + goto err_ret; + } match_pdomain = &(match_cpc_ptr->domain_info); if (match_pdomain->domain != pdomain->domain)