summaryrefslogtreecommitdiff
path: root/src/sys/arch/amd64/cpu/cpu_mp.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-09-17 03:11:44 -0400
committerIan Moffett <ian@osmora.org>2025-09-17 03:12:58 -0400
commitdf9eb8790b8e49c63beaef93c3194f1b0ed48f4d (patch)
tree4b6120d18cc14db13e4deaee1e170497ebd6c116 /src/sys/arch/amd64/cpu/cpu_mp.c
parent310ddfe46bfe3beffb9a224c36eba74a49c7c77d (diff)
kernel/amd64: mp: Use NULL instead of wrapping
It is best to return NULL when there is no next CPU instead of wrapping so we have an indicator at where the list ends. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/arch/amd64/cpu/cpu_mp.c')
-rw-r--r--src/sys/arch/amd64/cpu/cpu_mp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sys/arch/amd64/cpu/cpu_mp.c b/src/sys/arch/amd64/cpu/cpu_mp.c
index 3483e4a..28ca6ee 100644
--- a/src/sys/arch/amd64/cpu/cpu_mp.c
+++ b/src/sys/arch/amd64/cpu/cpu_mp.c
@@ -89,8 +89,8 @@ cpu_get(uint16_t index)
return &g_bsp;
}
- if ((index - 1) >= ncores_up) {
- index %= (ncores_up - 1);
+ if ((index - 1) >= (ncores_up - 1)) {
+ return NULL;
}
return corelist[index - 1];