PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths

[ Upstream commit bca718988b ]

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: 68a15eb7bd ("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>
This commit is contained in:
Christophe JAILLET 2020-04-18 10:16:37 +02:00 committed by Greg Kroah-Hartman
parent 4d30daf901
commit 9eb54d0e89
1 changed files with 1 additions and 1 deletions

View 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;