From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E15BC4345F for ; Fri, 26 Apr 2024 15:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=leyzZwi2rv9a6EfGqoTqqjxbIK2+0yEe4qrd2vg5H6M=; b=eWTp9upDvBLlv9 uiMpoeUC/cyrhJlrfYhvPrkA5/hmgIjQsPjv+U1iElvcgdTl27DGZDPY3k+H5lRiMOM8Zd+GrDWwx x4TAua1DeTXyqw+EjHDM7djh8kSvSDeTnZd4SKrK+8+fNzNpjxj/bl0NQhleqy8Q0NcWwsxMdlzL3 bam3Jr33kAhepq/txghniVP7d04vrgoRQBGV+VLXX0D/doWeXupN+CTtBfPDNFdvNbiMAsp3Oc+Pl ACJjtmv9SV4P4lHmIP4Q4Ex64G900fwOjzc27lufi4CILfzAlI4e/9dHTcctw5IvmxhmtPGAx4qgi IP5L9JAlQ036+lrd0x4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0NiK-0000000D6Sx-2cT9; Fri, 26 Apr 2024 15:42:16 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0NiG-0000000D6Qd-3njj for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2024 15:42:14 +0000 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VQxmM3Jprz6DB73; Fri, 26 Apr 2024 23:41:55 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 3EA19140A70; Fri, 26 Apr 2024 23:42:07 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 26 Apr 2024 16:42:06 +0100 Date: Fri, 26 Apr 2024 16:42:05 +0100 From: Jonathan Cameron To: Junhao He CC: , , , , , , , Subject: Re: [PATCH 3/3] drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset() Message-ID: <20240426164205.000029f3@Huawei.com> In-Reply-To: <20240425124627.13764-4-hejunhao3@huawei.com> References: <20240425124627.13764-1-hejunhao3@huawei.com> <20240425124627.13764-4-hejunhao3@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100002.china.huawei.com (7.191.160.241) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_084213_120217_6B112F93 X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 25 Apr 2024 20:46:27 +0800 Junhao He wrote: > From: Hao Chen > > pci_alloc_irq_vectors() allocates an irq vector. When devm_add_action() > fails, the irq vector is not freed, which leads to a memory leak. > > Replace the devm_add_action with devm_add_action_or_reset to ensure > the irq vector can be destroyed when it fails. > > Fixes: 66637ab137b4 ("drivers/perf: hisi: add driver for HNS3 PMU") > Signed-off-by: Hao Chen > Signed-off-by: Junhao He Acked-by: Jonathan Cameron Thanks, > --- > drivers/perf/hisilicon/hns3_pmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c > index cbdd53b0a034..60062eaa342a 100644 > --- a/drivers/perf/hisilicon/hns3_pmu.c > +++ b/drivers/perf/hisilicon/hns3_pmu.c > @@ -1527,7 +1527,7 @@ static int hns3_pmu_irq_register(struct pci_dev *pdev, > return ret; > } > > - ret = devm_add_action(&pdev->dev, hns3_pmu_free_irq, pdev); > + ret = devm_add_action_or_reset(&pdev->dev, hns3_pmu_free_irq, pdev); > if (ret) { > pci_err(pdev, "failed to add free irq action, ret = %d.\n", ret); > return ret; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel