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>
This commit is contained in:
Markus Elfring 2017-10-30 13:26:32 +01:00 committed by Bjorn Helgaas
parent 9e66317d3c
commit 05196e258a
1 changed files with 11 additions and 8 deletions

View File

@ -1267,20 +1267,19 @@ static int unconfigure_boot_device(u8 busno, u8 device, u8 function)
size = size & 0xFFFFFFFC; size = size & 0xFFFFFFFC;
size = ~size + 1; size = ~size + 1;
end_address = start_address + size - 1; end_address = start_address + size - 1;
if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { if (ibmphp_find_resource(bus, start_address, &io, IO))
err("cannot find corresponding IO resource to remove\n"); goto report_search_failure;
return -EIO;
}
debug("io->start = %x\n", io->start); debug("io->start = %x\n", io->start);
temp_end = io->end; temp_end = io->end;
start_address = io->end + 1; start_address = io->end + 1;
ibmphp_remove_resource(io); ibmphp_remove_resource(io);
/* This is needed b/c of the old I/O restrictions in the BIOS */ /* This is needed b/c of the old I/O restrictions in the BIOS */
while (temp_end < end_address) { while (temp_end < end_address) {
if (ibmphp_find_resource(bus, start_address, &io, IO) < 0) { if (ibmphp_find_resource(bus, start_address,
err("cannot find corresponding IO resource to remove\n"); &io, IO))
return -EIO; goto report_search_failure;
}
debug("io->start = %x\n", io->start); debug("io->start = %x\n", io->start);
temp_end = io->end; temp_end = io->end;
start_address = io->end + 1; start_address = io->end + 1;
@ -1327,6 +1326,10 @@ static int unconfigure_boot_device(u8 busno, u8 device, u8 function)
} /* end of for */ } /* end of for */
return 0; return 0;
report_search_failure:
err("cannot find corresponding IO resource to remove\n");
return -EIO;
} }
static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function) static int unconfigure_boot_bridge(u8 busno, u8 device, u8 function)