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
This commit is contained in:
Bjorn Helgaas 2026-02-06 17:09:19 -06:00
commit 65a5ac66cd

View File

@ -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