diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2015-07-28 19:10:45 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-07-29 09:11:49 +0200 |
commit | 2b1df72416a858f928c4edcbbb7f13b8dfc10a35 (patch) | |
tree | 43d5dc414ae0ee51d06f994b342d3e58961664b5 /arch/s390/pci | |
parent | s390: remove generic email address from maintainers file (diff) | |
download | linux-2b1df72416a858f928c4edcbbb7f13b8dfc10a35.tar.xz linux-2b1df72416a858f928c4edcbbb7f13b8dfc10a35.zip |
s390/pci: free resources after failed bus allocation
Free bus resources when the allocation/registration of the bus failed.
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/pci')
-rw-r--r-- | arch/s390/pci/pci.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 6316f4935f78..17c04c7269e7 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -632,7 +632,7 @@ static void zpci_cleanup_bus_resources(struct zpci_dev *zdev) int i; for (i = 0; i < PCI_BAR_COUNT; i++) { - if (!zdev->bars[i].size) + if (!zdev->bars[i].size || !zdev->bars[i].res) continue; zpci_free_iomap(zdev, zdev->bars[i].map_idx); @@ -772,17 +772,22 @@ static int zpci_scan_bus(struct zpci_dev *zdev) ret = zpci_setup_bus_resources(zdev, &resources); if (ret) - return ret; + goto error; zdev->bus = pci_scan_root_bus(NULL, ZPCI_BUS_NR, &pci_root_ops, zdev, &resources); if (!zdev->bus) { - zpci_cleanup_bus_resources(zdev); - return -EIO; + ret = -EIO; + goto error; } zdev->bus->max_bus_speed = zdev->max_bus_speed; pci_bus_add_devices(zdev->bus); return 0; + +error: + zpci_cleanup_bus_resources(zdev); + pci_free_resource_list(&resources); + return ret; } int zpci_enable_device(struct zpci_dev *zdev) |