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

PCI: faraday: 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>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>

authored by

Lorenzo Pieralisi and committed by
Bjorn Helgaas
9aa17a77 5c3f18cc

+1 -1
+1 -1
drivers/pci/host/pci-ftpci100.c
··· 448 448 u32 val; 449 449 LIST_HEAD(res); 450 450 451 - host = pci_alloc_host_bridge(sizeof(*p)); 451 + host = devm_pci_alloc_host_bridge(dev, sizeof(*p)); 452 452 if (!host) 453 453 return -ENOMEM; 454 454