mb/emulation/qemu-i440fx: Refactor `fw_cfg_max_cpus()`

Return 0 instead of -1 in case of error. Both values indicate an error
has happened. Adapt `cpu_bus_scan()` accordingly.

Change-Id: I0f83fdc41c20ed3aae80829432fc84024f5b9b47
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58918
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Angel Pons 2021-11-03 16:42:48 +01:00 committed by Felix Held
parent 04c497a6ba
commit d16d00b71a
2 changed files with 3 additions and 3 deletions

View File

@ -133,7 +133,7 @@ int fw_cfg_max_cpus(void)
unsigned short max_cpus;
if (!fw_cfg_present())
return -1;
return 0;
fw_cfg_get(FW_CFG_MAX_CPUS, &max_cpus, sizeof(max_cpus));
return max_cpus;

View File

@ -265,11 +265,11 @@ static void cpu_bus_init(struct device *dev)
static void cpu_bus_scan(struct device *bus)
{
int max_cpus = fw_cfg_max_cpus();
unsigned int max_cpus = fw_cfg_max_cpus();
struct device *cpu;
int i;
if (max_cpus < 0)
if (max_cpus == 0)
return;
/*
* Do not install more CPUs than supported by coreboot.