diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-10-30 08:26:32 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-06 19:47:15 -0500 |
commit | 05196e258a617ee14dd3255c480cbc3f0caff5ce (patch) | |
tree | a7b6cca5760c24c96a4f9680f3495636d7a618c9 /drivers/pci/hotplug/ibmphp_pci.c | |
parent | 9e66317d3c92ddaab330c125dfe9d06eee268aff (diff) |
PCI: ibmphp: Use common error handling code in unconfigure_boot_device()
Combine two error paths that emit the same message and return the same
error code.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/hotplug/ibmphp_pci.c')
-rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index dc1876feb06f..25edd0b18b75 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
@@ -1267,20 +1267,19 @@ static int unconfigure_boot_device(u8 busno, u8 device, u8 function) | |||
1267 | size = size & 0xFFFFFFFC; | 1267 | size = size & 0xFFFFFFFC; |
1268 | size = ~size + 1; | 1268 | size = ~size + 1; |
1269 | end_address = start_address + size - 1; | 1269 | end_address = start_address + size - 1; |
1270 | if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { | 1270 | if (ibmphp_find_resource(bus, start_address, &io, IO)) |
1271 | err("cannot find corresponding IO resource to remove\n"); | 1271 | goto report_search_failure; |
1272 | return -EIO; | 1272 | |
1273 | } | ||
1274 | debug("io->start = %x\n", io->start); | 1273 | debug("io->start = %x\n", io->start); |
1275 | temp_end = io->end; | 1274 | temp_end = io->end; |
1276 | start_address = io->end + 1; | 1275 | start_address = io->end + 1; |
1277 | ibmphp_remove_resource(io); | 1276 | ibmphp_remove_resource(io); |
1278 | /* This is needed b/c of the old I/O restrictions in the BIOS */ | 1277 | /* This is needed b/c of the old I/O restrictions in the BIOS */ |
1279 | while (temp_end < end_address) { | 1278 | while (temp_end < end_address) { |
1280 | if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { | 1279 | if (ibmphp_find_resource(bus, start_address, |
1281 | err("cannot find corresponding IO resource to remove\n"); | 1280 | &io, IO)) |
1282 | return -EIO; | 1281 | goto report_search_failure; |
1283 | } | 1282 | |
1284 | debug("io->start = %x\n", io->start); | 1283 | debug("io->start = %x\n", io->start); |
1285 | temp_end = io->end; | 1284 | temp_end = io->end; |
1286 | start_address = io->end + 1; | 1285 | start_address = io->end + 1; |
@@ -1327,6 +1326,10 @@ static int unconfigure_boot_device(u8 busno, u8 device, u8 function) | |||
1327 | } /* end of for */ | 1326 | } /* end of for */ |
1328 | 1327 | ||
1329 | return 0; | 1328 | return 0; |
1329 | |||
1330 | report_search_failure: | ||
1331 | err("cannot find corresponding IO resource to remove\n"); | ||
1332 | return -EIO; | ||
1330 | } | 1333 | } |
1331 | 1334 | ||
1332 | static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function) | 1335 | static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function) |