From patchwork Fri Jan 17 01:29:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 3502831 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 138649F2E9 for ; Fri, 17 Jan 2014 09:06:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9B0B20158 for ; Fri, 17 Jan 2014 09:06:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BFA5B2015E for ; Fri, 17 Jan 2014 09:06:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED214FD106; Fri, 17 Jan 2014 01:06:06 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 304 seconds by postgrey-1.32 at gabe; Thu, 16 Jan 2014 17:35:28 PST Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by gabe.freedesktop.org (Postfix) with ESMTP id ABFEA105858; Thu, 16 Jan 2014 17:35:28 -0800 (PST) Received: from 172.24.2.119 (EHLO szxeml207-edg.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AJJ63924; Fri, 17 Jan 2014 09:30:11 +0800 (CST) Received: from SZXEML448-HUB.china.huawei.com (10.82.67.191) by szxeml207-edg.china.huawei.com (172.24.2.56) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 17 Jan 2014 09:30:05 +0800 Received: from localhost (10.177.27.212) by szxeml448-hub.china.huawei.com (10.82.67.191) with Microsoft SMTP Server id 14.3.158.1; Fri, 17 Jan 2014 09:30:01 +0800 From: Yijing Wang To: "Rafael J. Wysocki" Subject: [PATCH v2] ACPI: Fix acpi_evaluate_object() return value check Date: Fri, 17 Jan 2014 09:29:51 +0800 Message-ID: <1389922191-28664-1-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.11.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.27.212] X-CFilter-Loop: Reflected X-Mailman-Approved-At: Fri, 17 Jan 2014 01:05:58 -0800 Cc: Greg Kroah-Hartman , Daniel Vetter , intel-gfx@lists.freedesktop.org, Hanjun Guo , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Yijing Wang , dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, Bjorn Helgaas , Dave Airlie X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix acpi_evaluate_object() return value check, shoud acpi_status not int. Signed-off-by: Yijing Wang --- v1->v2: Add CC to the related subsystem MAINTAINERS. --- drivers/gpu/drm/i915/intel_acpi.c | 13 +++++++------ drivers/gpu/drm/nouveau/core/subdev/mxm/base.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_acpi.c | 13 +++++++------ drivers/pci/pci-label.c | 6 +++--- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c index dfff090..7ea00e5 100644 --- a/drivers/gpu/drm/i915/intel_acpi.c +++ b/drivers/gpu/drm/i915/intel_acpi.c @@ -35,7 +35,7 @@ static int intel_dsm(acpi_handle handle, int func) union acpi_object params[4]; union acpi_object *obj; u32 result; - int ret = 0; + acpi_status status; input.count = 4; input.pointer = params; @@ -50,8 +50,8 @@ static int intel_dsm(acpi_handle handle, int func) params[3].package.count = 0; params[3].package.elements = NULL; - ret = acpi_evaluate_object(handle, "_DSM", &input, &output); - if (ret) { + status = acpi_evaluate_object(handle, "_DSM", &input, &output); + if (ACPI_FAILURE(status)) { DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret); return ret; } @@ -141,7 +141,8 @@ static void intel_dsm_platform_mux_info(void) struct acpi_object_list input; union acpi_object params[4]; union acpi_object *pkg; - int i, ret; + acpi_status status; + int i; input.count = 4; input.pointer = params; @@ -156,9 +157,9 @@ static void intel_dsm_platform_mux_info(void) params[3].package.count = 0; params[3].package.elements = NULL; - ret = acpi_evaluate_object(intel_dsm_priv.dhandle, "_DSM", &input, + acpi_status = acpi_evaluate_object(intel_dsm_priv.dhandle, "_DSM", &input, &output); - if (ret) { + if (ACPI_FAILURE(status)) { DRM_DEBUG_DRIVER("failed to evaluate _DSM: %d\n", ret); goto out; } diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c index 1291204..3920943 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c @@ -114,14 +114,14 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version) struct acpi_buffer retn = { ACPI_ALLOCATE_BUFFER, NULL }; union acpi_object *obj; acpi_handle handle; - int ret; + acpi_status status; handle = ACPI_HANDLE(&device->pdev->dev); if (!handle) return false; - ret = acpi_evaluate_object(handle, "_DSM", &list, &retn); - if (ret) { + status = acpi_evaluate_object(handle, "_DSM", &list, &retn); + if (ACPI_FAILURE(status)) { nv_debug(mxm, "DSM MXMS failed: %d\n", ret); return false; } diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index ba0183f..6f810f2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -82,7 +82,8 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * struct acpi_object_list input; union acpi_object params[4]; union acpi_object *obj; - int i, err; + acpi_status status; + int i; char args_buff[4]; input.count = 4; @@ -101,8 +102,8 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * args_buff[i] = (arg >> i * 8) & 0xFF; params[3].buffer.pointer = args_buff; - err = acpi_evaluate_object(handle, "_DSM", &input, &output); - if (err) { + status = acpi_evaluate_object(handle, "_DSM", &input, &output); + if (ACPI_FAILURE(status)) { printk(KERN_INFO "failed to evaluate _DSM: %d\n", err); return err; } @@ -134,7 +135,7 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result) struct acpi_object_list input; union acpi_object params[4]; union acpi_object *obj; - int err; + acpi_status status; input.count = 4; input.pointer = params; @@ -148,8 +149,8 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result) params[3].type = ACPI_TYPE_INTEGER; params[3].integer.value = arg; - err = acpi_evaluate_object(handle, "_DSM", &input, &output); - if (err) { + status = acpi_evaluate_object(handle, "_DSM", &input, &output); + if (ACPI_FAILURE(status)) { printk(KERN_INFO "failed to evaluate _DSM: %d\n", err); return err; } diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index d51f45a..3c21f1b 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c @@ -213,7 +213,7 @@ dsm_get_label(acpi_handle handle, int func, union acpi_object *obj; int len = 0; - int err; + acpi_status status; input.count = 4; input.pointer = params; @@ -228,8 +228,8 @@ dsm_get_label(acpi_handle handle, int func, params[3].package.count = 0; params[3].package.elements = NULL; - err = acpi_evaluate_object(handle, "_DSM", &input, output); - if (err) + status = acpi_evaluate_object(handle, "_DSM", &input, output); + if (ACPI_FAILURE(status)) return -1; obj = (union acpi_object *)output->pointer;