diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2020-04-18 10:16:37 +0200 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2020-05-05 13:00:05 +0200 |
commit | bca718988b9008d0d5f504e2d318178fc84958c1 (patch) | |
tree | 7bb60d15feb12a9f93009048a85aa2d639b2adba /drivers/pci/controller/pci-v3-semi.c | |
parent | Linux 5.7-rc1 (diff) | |
download | linux-bca718988b9008d0d5f504e2d318178fc84958c1.tar.xz linux-bca718988b9008d0d5f504e2d318178fc84958c1.zip |
PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths
If we fails somewhere in 'v3_pci_probe()', we need to free 'host'.
Use the managed version of 'pci_alloc_host_bridge()' to do that easily.
The use of managed resources is already widely used in this driver.
Link: https://lore.kernel.org/r/20200418081637.1585-1-christophe.jaillet@wanadoo.fr
Fixes: 68a15eb7bd0c ("PCI: v3-semi: Add V3 Semiconductor PCI host driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
[lorenzo.pieralisi@arm.com: commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pci/controller/pci-v3-semi.c')
-rw-r--r-- | drivers/pci/controller/pci-v3-semi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c index bd05221f5a22..ddcb4571a79b 100644 --- a/drivers/pci/controller/pci-v3-semi.c +++ b/drivers/pci/controller/pci-v3-semi.c @@ -720,7 +720,7 @@ static int v3_pci_probe(struct platform_device *pdev) int irq; int ret; - host = pci_alloc_host_bridge(sizeof(*v3)); + host = devm_pci_alloc_host_bridge(dev, sizeof(*v3)); if (!host) return -ENOMEM; |