summaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2026-02-06 17:09:19 -0600
committerBjorn Helgaas <bhelgaas@google.com>2026-02-06 17:09:19 -0600
commit65a5ac66cd975d61e674f5633755e68c432888be (patch)
tree0fee6da43687a583f1571d4ade704ad7881d319e /drivers/pci
parent077557d13f092ebef03f39ba7940e76fce1fd82a (diff)
parent62171369cf17794ddd88f602c2c84d008ecafcff (diff)
Merge branch 'pci/ptm'
- Fix leaks of ptm_debugfs in pcie_ptm_create_debugfs() and pcie_ptm_destroy_debugfs() (Aadityarangan Shridhar Iyengar) * pci/ptm: PCI/PTM: Fix pcie_ptm_create_debugfs() memory leak
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/ptm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c
index ed0f9691e7d1..c7c61869bc9c 100644
--- a/drivers/pci/pcie/ptm.c
+++ b/drivers/pci/pcie/ptm.c
@@ -542,8 +542,10 @@ struct pci_ptm_debugfs *pcie_ptm_create_debugfs(struct device *dev, void *pdata,
return NULL;
dirname = devm_kasprintf(dev, GFP_KERNEL, "pcie_ptm_%s", dev_name(dev));
- if (!dirname)
+ if (!dirname) {
+ kfree(ptm_debugfs);
return NULL;
+ }
ptm_debugfs->debugfs = debugfs_create_dir(dirname, NULL);
ptm_debugfs->pdata = pdata;
@@ -574,6 +576,7 @@ void pcie_ptm_destroy_debugfs(struct pci_ptm_debugfs *ptm_debugfs)
mutex_destroy(&ptm_debugfs->lock);
debugfs_remove_recursive(ptm_debugfs->debugfs);
+ kfree(ptm_debugfs);
}
EXPORT_SYMBOL_GPL(pcie_ptm_destroy_debugfs);
#endif