Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: tegra: Fix host bridge memory leakage

When probing the PCI host controller driver, if an error occurs, the probe
function code does not free memory allocated for the struct pci_host_bridge
resulting in memory leakage.

Move the struct pci_host_bridge allocation over to the respective devm
interface to fix the issue.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>

authored by

Lorenzo Pieralisi and committed by
Bjorn Helgaas
792abc6e 9aa17a77

+1 -1
+1 -1
drivers/pci/host/pci-tegra.c
··· 2238 2238 struct pci_bus *child; 2239 2239 int err; 2240 2240 2241 - host = pci_alloc_host_bridge(sizeof(*pcie)); 2241 + host = devm_pci_alloc_host_bridge(dev, sizeof(*pcie)); 2242 2242 if (!host) 2243 2243 return -ENOMEM; 2244 2244