Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp172489lqf; Fri, 26 Apr 2024 03:19:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXj0h9gp8ARygPQFacP51aFV01XYJxMmw9OE6Kn94XnfDjaUSw7IJpChb8bWP4igHfnWxZko9NgAMzD7u4XLVdo+YMU+Vu/iWVUJWZ/gw== X-Google-Smtp-Source: AGHT+IGV0t4a66olla9tzOeljKFnvLo9roHGNFdleSw5PMlyJPzw/AN7FfVomAwlrdc2ESAkpDXC X-Received: by 2002:a05:6830:3101:b0:6eb:da6b:75 with SMTP id b1-20020a056830310100b006ebda6b0075mr1996583ots.3.1714126791198; Fri, 26 Apr 2024 03:19:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714126791; cv=pass; d=google.com; s=arc-20160816; b=K8aTMJf2AYTWb7N1M4RThPk1B4ol8lraf8fbZnDXWLMTrEZ/PKaHOMcVcrpMnKrPzp zEj/qNUao6YC3QjaL1WQG/ns4NO8Xg4ilvj4CS8ftStcQub9YOd/kx4nPJbGTJyx+GBB OA/b9OC+lqV4UVNwmi5hX7/JDzYL2uSatSWZ83d3Wr8qAN3EAGGtULh5ZYICwnM9KdfO 8IA5I0Ymw34FvNmiin9tMgHXSFgY18HGxrXthabPrW7SRzlHetmtGDzHRE3GTokVxBND ZAbM6ocNx6BbqnU98sDd2l85dUVw7sRIL/8lGgsGBBXYdkivth4Sn7MUP3i7bnGpqYOt qSzA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to:subject:cc :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=VgfEKUVl8XK9q2P6fKBHRlWvFwVW8zOZcuwJvNwPie0=; fh=+NzF+CZgyeRGNsdTqkRspD8F+Ce2IRXB5ZIFgX9whVs=; b=Q4CpaoDlEyZXeF8uzesnq+NJ0mOmD6ZDWHEKuiTiNkQpEBQfQekLWEn/34q/o/dSH6 HUPAdvyAZsawVSyK3KzKBayrQvoBmr61jU3wgYjd/qdjJqWM/JCOqQYYpQcOQuuKpNLj 6GPEGmj5wbiNPAsu150Qs11Bsa+x54bWUUFhiJvDs8eNq56CNQSk1Vqt97YUwCprvz0l +cU40kka7oTEta3Kee2r22LFqGMbKOw4i7/TyLZW5Py5ZCFu8MWomGhl6e5yeTBU6pPt 4NWfLZyq/9IW/cjJPVQRd62E+a18UjFoPR3qL1H5hh8Tyrj2EppZApJKL3LXwPhviL61 cbBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-159856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w13-20020a63b74d000000b005dc5070656csi15206836pgt.785.2024.04.26.03.19.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 03:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-159856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C815F28AC8F for ; Fri, 26 Apr 2024 10:19:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D62C14534B; Fri, 26 Apr 2024 10:17:48 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9125A142E9F for ; Fri, 26 Apr 2024 10:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714126668; cv=none; b=WGm0ZY4NN3zZOvVhSr8A2dTnLyDa684ChrGkO2SlaiGpat9eG7AoDjsjoLj6no9oCsdcuvC8mw/o3n1GxgF1N06e3yKBi9Fmtk9LdQiBdhaMWcKU+EvrIHPmgv+A4Im8wOi/mMwdCoOjPNjJdlnX3bjfwKa8joVuKRCfQkC/gwY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714126668; c=relaxed/simple; bh=UA+qhiN+Bq3ho/gVgazfx7ShJo3fwf6VSLFedZizZpY=; h=Message-ID:Date:MIME-Version:CC:Subject:To:References:From: In-Reply-To:Content-Type; b=Z5YxiuNX7AXTck7hWEnEvL2qoN96hgdMy2G/TX1abcrShhIwrXKISzuPOc4u4SHLNiBvp2xCSqbmbjL2HVF+O+clgrQBGKZv0eOYxdRUMTaO+lq1qCzNGNQPQ/iueL+JYfqZShczQbrZHFFpG2J5J5Ygk+CX7whKsGOqn8dSNeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VQpWD5gTqz1yn2v; Fri, 26 Apr 2024 18:15:04 +0800 (CST) Received: from kwepemm600007.china.huawei.com (unknown [7.193.23.208]) by mail.maildlp.com (Postfix) with ESMTPS id E71B9140134; Fri, 26 Apr 2024 18:17:37 +0800 (CST) Received: from [10.67.120.192] (10.67.120.192) by kwepemm600007.china.huawei.com (7.193.23.208) 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 18:17:37 +0800 Message-ID: <9c402089-1aed-4777-84af-5879bf72624b@huawei.com> Date: Fri, 26 Apr 2024 18:17:36 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird CC: , , , , , Subject: Re: [PATCH 3/3] drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset() To: Junhao He , , , References: <20240425124627.13764-1-hejunhao3@huawei.com> <20240425124627.13764-4-hejunhao3@huawei.com> From: Jijie Shao In-Reply-To: <20240425124627.13764-4-hejunhao3@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600007.china.huawei.com (7.193.23.208) Reviewed-by: Jijie Shao on 2024/4/25 20:46, 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 > --- > 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;