]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 18 Apr 2020 08:16:37 +0000 (10:16 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tue, 5 May 2020 11:00:05 +0000 (12:00 +0100)
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>
drivers/pci/controller/pci-v3-semi.c

index bd05221f5a22fcea9c94902a888106697eaefefe..ddcb4571a79b3372a610484a6815edaa172171b5 100644 (file)
@@ -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;