Skip to content

Commit

Permalink
PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths
Browse files Browse the repository at this point in the history
[ Upstream commit bca7189 ]

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/[email protected]
Fixes: 68a15eb ("PCI: v3-semi: Add V3 Semiconductor PCI host driver")
Signed-off-by: Christophe JAILLET <[email protected]>
[[email protected]: commit log]
Signed-off-by: Lorenzo Pieralisi <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
tititiou36 authored and gregkh committed Jun 24, 2020
1 parent f799194 commit ce6a727
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/controller/pci-v3-semi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit ce6a727

Please sign in to comment.