]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Sat, 8 Aug 2020 05:53:12 +0000 (01:53 -0400)
BugLink: https://bugs.launchpad.net/bugs/1885322
[ Upstream commit bca718988b9008d0d5f504e2d318178fc84958c1 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/pci/controller/pci-v3-semi.c

index d219404bad92b8394b902554b81f44d6c544869a..9a86bb7448acfe3d00ebeaf6eed684a41b5308d2 100644 (file)
@@ -743,7 +743,7 @@ static int v3_pci_probe(struct platform_device *pdev)
        int ret;
        LIST_HEAD(res);
 
-       host = pci_alloc_host_bridge(sizeof(*v3));
+       host = devm_pci_alloc_host_bridge(dev, sizeof(*v3));
        if (!host)
                return -ENOMEM;