diff options
author | Hao Chen <chenhao418@huawei.com> | 2024-04-25 15:46:27 +0300 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2024-04-28 10:49:31 +0300 |
commit | 582c1aeee0a9e73010cf1c4cef338709860deeb0 (patch) | |
tree | b66f93aa8862e5c08fe7b44bfc1874723f922c44 /drivers/perf | |
parent | 81bdd60a3d1d3b05e6cc6674845afb1694dd3a0e (diff) | |
download | linux-582c1aeee0a9e73010cf1c4cef338709860deeb0.tar.xz |
drivers/perf: hisi: hns3: Actually use devm_add_action_or_reset()
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 <chenhao418@huawei.com>
Signed-off-by: Junhao He <hejunhao3@huawei.com>
Reviewed-by: Jijie Shao <shaojijie@huawei.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240425124627.13764-4-hejunhao3@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf')
-rw-r--r-- | drivers/perf/hisilicon/hns3_pmu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c index 0417bf23fa3e..e900f8e00b18 100644 --- a/drivers/perf/hisilicon/hns3_pmu.c +++ b/drivers/perf/hisilicon/hns3_pmu.c @@ -1528,7 +1528,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; |