diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-12 16:07:04 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-19 11:17:22 -0400 |
commit | 9e808eb6a7689b61399f772a2576d779161769ec (patch) | |
tree | 73af8c5605ba91394b1fffdc964a03741b4897c4 /arch/arm | |
parent | a0c8a4d9f92d1ecd053eaa0e6cde7b4f24af97a8 (diff) |
PCI: Cleanup control flow
Return errors immediately so the straightline path is the normal,
no-error path. No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-dove/pcie.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-mv78xx0/pcie.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/pci.c | 32 |
3 files changed, 22 insertions, 34 deletions
diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index 8a275f297522..91fe97144570 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c | |||
@@ -155,17 +155,13 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); | |||
155 | static struct pci_bus __init * | 155 | static struct pci_bus __init * |
156 | dove_pcie_scan_bus(int nr, struct pci_sys_data *sys) | 156 | dove_pcie_scan_bus(int nr, struct pci_sys_data *sys) |
157 | { | 157 | { |
158 | struct pci_bus *bus; | 158 | if (nr >= num_pcie_ports) { |
159 | |||
160 | if (nr < num_pcie_ports) { | ||
161 | bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | ||
162 | &sys->resources); | ||
163 | } else { | ||
164 | bus = NULL; | ||
165 | BUG(); | 159 | BUG(); |
160 | return NULL; | ||
166 | } | 161 | } |
167 | 162 | ||
168 | return bus; | 163 | return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, |
164 | &sys->resources); | ||
169 | } | 165 | } |
170 | 166 | ||
171 | static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 167 | static int __init dove_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 445e553f4a28..097ea4cb1136 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c | |||
@@ -197,17 +197,13 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL, PCI_ANY_ID, rc_pci_fixup); | |||
197 | static struct pci_bus __init * | 197 | static struct pci_bus __init * |
198 | mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys) | 198 | mv78xx0_pcie_scan_bus(int nr, struct pci_sys_data *sys) |
199 | { | 199 | { |
200 | struct pci_bus *bus; | 200 | if (nr >= num_pcie_ports) { |
201 | |||
202 | if (nr < num_pcie_ports) { | ||
203 | bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | ||
204 | &sys->resources); | ||
205 | } else { | ||
206 | bus = NULL; | ||
207 | BUG(); | 201 | BUG(); |
202 | return NULL; | ||
208 | } | 203 | } |
209 | 204 | ||
210 | return bus; | 205 | return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, |
206 | &sys->resources); | ||
211 | } | 207 | } |
212 | 208 | ||
213 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, | 209 | static int __init mv78xx0_pcie_map_irq(const struct pci_dev *dev, u8 slot, |
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 87a12d6930ff..b02f3947be51 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c | |||
@@ -540,37 +540,33 @@ void __init orion5x_pci_set_cardbus_mode(void) | |||
540 | 540 | ||
541 | int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) | 541 | int __init orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys) |
542 | { | 542 | { |
543 | int ret = 0; | ||
544 | |||
545 | vga_base = ORION5X_PCIE_MEM_PHYS_BASE; | 543 | vga_base = ORION5X_PCIE_MEM_PHYS_BASE; |
546 | 544 | ||
547 | if (nr == 0) { | 545 | if (nr == 0) { |
548 | orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr); | 546 | orion_pcie_set_local_bus_nr(PCIE_BASE, sys->busnr); |
549 | ret = pcie_setup(sys); | 547 | return pcie_setup(sys); |
550 | } else if (nr == 1 && !orion5x_pci_disabled) { | 548 | } |
549 | |||
550 | if (nr == 1 && !orion5x_pci_disabled) { | ||
551 | orion5x_pci_set_bus_nr(sys->busnr); | 551 | orion5x_pci_set_bus_nr(sys->busnr); |
552 | ret = pci_setup(sys); | 552 | return pci_setup(sys); |
553 | } | 553 | } |
554 | 554 | ||
555 | return ret; | 555 | return 0; |
556 | } | 556 | } |
557 | 557 | ||
558 | struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys) | 558 | struct pci_bus __init *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys) |
559 | { | 559 | { |
560 | struct pci_bus *bus; | 560 | if (nr == 0) |
561 | return pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | ||
562 | &sys->resources); | ||
561 | 563 | ||
562 | if (nr == 0) { | 564 | if (nr == 1 && !orion5x_pci_disabled) |
563 | bus = pci_scan_root_bus(NULL, sys->busnr, &pcie_ops, sys, | 565 | return pci_scan_root_bus(NULL, sys->busnr, &pci_ops, sys, |
564 | &sys->resources); | 566 | &sys->resources); |
565 | } else if (nr == 1 && !orion5x_pci_disabled) { | ||
566 | bus = pci_scan_root_bus(NULL, sys->busnr, &pci_ops, sys, | ||
567 | &sys->resources); | ||
568 | } else { | ||
569 | bus = NULL; | ||
570 | BUG(); | ||
571 | } | ||
572 | 567 | ||
573 | return bus; | 568 | BUG(); |
569 | return NULL; | ||
574 | } | 570 | } |
575 | 571 | ||
576 | int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 572 | int __init orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |