Angel Pons has uploaded this change for review.

View Change

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>
---
M src/mainboard/emulation/qemu-i440fx/fw_cfg.c
M src/mainboard/emulation/qemu-i440fx/northbridge.c
2 files changed, 3 insertions(+), 3 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/18/58918/1
diff --git a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c
index 01be2c3..3206e4c 100644
--- a/src/mainboard/emulation/qemu-i440fx/fw_cfg.c
+++ b/src/mainboard/emulation/qemu-i440fx/fw_cfg.c
@@ -133,7 +133,7 @@
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;
diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c
index d041b0c..9785a3a 100644
--- a/src/mainboard/emulation/qemu-i440fx/northbridge.c
+++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c
@@ -265,11 +265,11 @@

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.

To view, visit change 58918. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0f83fdc41c20ed3aae80829432fc84024f5b9b47
Gerrit-Change-Number: 58918
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus@gmail.com>
Gerrit-MessageType: newchange