Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2498325pxb; Sun, 5 Sep 2021 21:21:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwF3CWEar8q94QzI3ndo5hGJUouy0ENiiibs2iS1+LsEma5aIRx7cg9y73avGM8Gy76VKYy X-Received: by 2002:a6b:2c45:: with SMTP id s66mr8270275ios.213.1630902119739; Sun, 05 Sep 2021 21:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630902119; cv=none; d=google.com; s=arc-20160816; b=WmCo0UHhHepMc0v3WDorPu3SSZlt6NfagrnQBw+s58g+QCQVqNFQ43lyX3v2/oJLfM 9DvC7tivyZ35roQ3oqin+4V9yeiG4+xEp872U0s5pbS3o7qQcWUWc7WgeL+C6VUYBf0H Iu+wxhhqh06aR+elsQtDxS4QTk7e5AwQeYNpHU63jZEXWlRIpjNA7Q9sdaDfqx/9YlQA w5g/I//CJspuAe21hQaoqUtwn6tfIlbkHTRwW9/1yRBzeWKPC7plmihYb5uKk94LuN8z qQOg6K5Qs25tOEvcngsVzTHL6My7PE8X/KKnqDNZZLvFcwpVaSl4tCqyI0ObXi1taGO8 Nxzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=TOQJWHI+IP2NaToM/3/vdPCyDFVM6HCgtMTEhez7aag=; b=oN5YPfE74biZA8zUo8emgCGI1LK352QEb8sVmOdFQNcGdtRR8CwV5cQCaikJOj81x2 pYjHfU4YW2VPCoZnhZoFbpvrxj6ASpFsSL+Ln/UvHlHb7l9CTS+ClA+CJeUla1c6KzA0 VwapbaRW89T7TgcY3UL/BauBtuuNhoQl0QFqBqnUorz43UKP+cMJK2QNpw55HksLJqXl UO3elVyrgh8Wq1Ac0tHDkyR4pefxa5x1gIpBJco05XMZ8As3GYPl9p0AYlKsHUNm3mzV M0H9QFoldajDT4q4y/TkcFawKP+dOmjUTLsyk430RrhWt3CPYSgWMmfNeqwfjcs7l69C 0KvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si7872138iom.82.2021.09.05.21.21.48; Sun, 05 Sep 2021 21:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232680AbhIFDg5 (ORCPT + 99 others); Sun, 5 Sep 2021 23:36:57 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:15292 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbhIFDg4 (ORCPT ); Sun, 5 Sep 2021 23:36:56 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4H2vDV6C3cz8sqH; Mon, 6 Sep 2021 11:35:22 +0800 (CST) Received: from dggema764-chm.china.huawei.com (10.1.198.206) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Mon, 6 Sep 2021 11:35:50 +0800 Received: from DESKTOP-8RFUVS3.china.huawei.com (10.174.185.179) by dggema764-chm.china.huawei.com (10.1.198.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 6 Sep 2021 11:35:49 +0800 From: Zenghui Yu To: , , CC: , , , , , , , , Zenghui Yu , "Kai-Heng Feng" Subject: [PATCH] drm/i915: Free the returned object of acpi_evaluate_dsm() Date: Mon, 6 Sep 2021 11:35:41 +0800 Message-ID: <20210906033541.862-1-yuzenghui@huawei.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.185.179] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggema764-chm.china.huawei.com (10.1.198.206) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As per the comment on top of acpi_evaluate_dsm(): | * Evaluate device's _DSM method with specified GUID, revision id and | * function number. Caller needs to free the returned object. We should free the returned object of acpi_evaluate_dsm() to avoid memory leakage. Otherwise the kmemleak splat will be triggered at boot time (if we compile kernel with CONFIG_DEBUG_TEST_DRIVER_REMOVE=y). Fixes: 8e55f99c510f ("drm/i915: Invoke another _DSM to enable MUX on HP Workstation laptops") Cc: Kai-Heng Feng Signed-off-by: Zenghui Yu --- drivers/gpu/drm/i915/display/intel_acpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c index 7cfe91fc05f2..68abeaf2d7d4 100644 --- a/drivers/gpu/drm/i915/display/intel_acpi.c +++ b/drivers/gpu/drm/i915/display/intel_acpi.c @@ -186,13 +186,16 @@ void intel_dsm_get_bios_data_funcs_supported(struct drm_i915_private *i915) { struct pci_dev *pdev = to_pci_dev(i915->drm.dev); acpi_handle dhandle; + union acpi_object *obj; dhandle = ACPI_HANDLE(&pdev->dev); if (!dhandle) return; - acpi_evaluate_dsm(dhandle, &intel_dsm_guid2, INTEL_DSM_REVISION_ID, - INTEL_DSM_FN_GET_BIOS_DATA_FUNCS_SUPPORTED, NULL); + obj = acpi_evaluate_dsm(dhandle, &intel_dsm_guid2, INTEL_DSM_REVISION_ID, + INTEL_DSM_FN_GET_BIOS_DATA_FUNCS_SUPPORTED, NULL); + if (obj) + ACPI_FREE(obj); } /* -- 2.19.1