Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp372364ybh; Wed, 22 Jul 2020 02:50:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNtinzKcSACVZr7Z/H0GUTwKvFPfMEH4B8+oexkJrJ11RDqKxIF7SB/prM9dY4fsOuzd8O X-Received: by 2002:a17:906:dbed:: with SMTP id yd13mr261404ejb.419.1595411449196; Wed, 22 Jul 2020 02:50:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595411449; cv=none; d=google.com; s=arc-20160816; b=H+sFzYBI9SBfASERBNuXolCrvtgrifhgFEE4VRIR0yLIOnvQq016JRtf5Sp264SiRX 3B/PMb+7xcOow9dUlP1ThcEQUgQa9UKmLRJz5W1rIbUA7VxOKcEWNA3skx6HMzf76Lyb 1+gUH8q9SgkkDkTZJwlvGqYwBTdDCFdomRkkkaOnfx3zVD3tBd9/rmemSUCE8242+pcU gNL59D3ahRObnQ1diX6Cek92R5WaENQDSOehfuLWToRQ6A+9zE5l5uDyAOnkAjQ/bdRL pQXznyVjZ0KcmEZmJ6SpK1XFCxt8wTogkbsz6E0gZUiuETXwe2yfikL6D6ifQJMkL4+J M2OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=n+dYyHrVvUDWQ1JiLHDhjQz2oDF+pFmnT94VqO7fWPs=; b=a8Sr7O1WY2LJSoSCf46pB+eyiqHe497Z3ra8wYYO1AIKO20CTrF1y+u//OL4t711zi ydx1MaJFnLGoIGwHkKvP5foUctKgOSauTZKD5GuIRm3VrxjaUPQ0vwF3PXWD+uAF844l 0Jieagol51IjBphIYAR4CH5q3yq3+fTXL+b/vHHOV3q8cXlu0PpXMsNx54XfK58Y+CTt JVVvNkmm4CIQsTpK/HJUVhFMdQOZPa7Kz8tn9LVrgFQM9NXIciBIZ7FZBAEcVq7Nj0Xu q5nCpYbt5dWhoadUNJPXSll/DCEfBfB/E1c4lQJpXcMeYjbMM7twKEsUs0M4SjZ4a7x5 ImVg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si12630451ejf.411.2020.07.22.02.50.26; Wed, 22 Jul 2020 02:50:49 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731283AbgGVJre (ORCPT + 99 others); Wed, 22 Jul 2020 05:47:34 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8351 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730142AbgGVJre (ORCPT ); Wed, 22 Jul 2020 05:47:34 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E06B03B132C9DC4F16B9 for ; Wed, 22 Jul 2020 17:47:30 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Wed, 22 Jul 2020 17:47:23 +0800 From: Hanjun Guo To: Jassi Brar CC: , Hanjun Guo Subject: [PATCH] mailbox: pcc: Put the PCCT table for error path Date: Wed, 22 Jul 2020 17:40:40 +0800 Message-ID: <1595410840-15231-1-git-send-email-guohanjun@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The acpi_get_table() should be coupled with acpi_put_table() if the mapped table is not used at runtime to release the table mapping. In acpi_pcc_probe(), the PCCT table entries will be used as private data for communication chan at runtime, but the table should be put for error path. Signed-off-by: Hanjun Guo --- drivers/mailbox/pcc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 8c7fac3..ef9ecd1 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -457,14 +457,17 @@ static int __init acpi_pcc_probe(void) pr_warn("Error parsing PCC subspaces from PCCT\n"); else pr_warn("Invalid PCCT: %d PCC subspaces\n", count); - return -EINVAL; + + rc = -EINVAL; + goto err_put_pcct; } pcc_mbox_channels = kcalloc(count, sizeof(struct mbox_chan), GFP_KERNEL); if (!pcc_mbox_channels) { pr_err("Could not allocate space for PCC mbox channels\n"); - return -ENOMEM; + rc = -ENOMEM; + goto err_put_pcct; } pcc_doorbell_vaddr = kcalloc(count, sizeof(void *), GFP_KERNEL); @@ -535,6 +538,8 @@ static int __init acpi_pcc_probe(void) kfree(pcc_doorbell_vaddr); err_free_mbox: kfree(pcc_mbox_channels); +err_put_pcct: + acpi_put_table(pcct_tbl); return rc; } -- 1.7.12.4