diff options
author | Sunil V L <sunilvl@ventanamicro.com> | 2022-05-27 10:47:40 +0530 |
---|---|---|
committer | Palmer Dabbelt <palmer@rivosinc.com> | 2022-07-19 16:39:03 -0700 |
commit | c029e487e7c00e5594a4ae946952605db34e359b (patch) | |
tree | 7f2a59e456d51f27dd7c48bb8969447e9538ae87 | |
parent | 869d40bdfca05e67ac6979535c485ab2c8fccc63 (diff) | |
download | linux-c029e487e7c00e5594a4ae946952605db34e359b.tar.gz linux-c029e487e7c00e5594a4ae946952605db34e359b.tar.bz2 linux-c029e487e7c00e5594a4ae946952605db34e359b.zip |
riscv: spinwait: Fix hartid variable type
The hartid variable is of type int but compared with
ULONG_MAX(INVALID_HARTID). This issue is fixed by changing
the hartid variable type to unsigned long.
Fixes: c78f94f35cf6 ("RISC-V: Use __cpu_up_stack/task_pointer only for spinwait method")
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20220527051743.2829940-3-sunilvl@ventanamicro.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-rw-r--r-- | arch/riscv/kernel/cpu_ops_spinwait.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/riscv/kernel/cpu_ops_spinwait.c b/arch/riscv/kernel/cpu_ops_spinwait.c index 346847f6c41c..3ade9152a3c7 100644 --- a/arch/riscv/kernel/cpu_ops_spinwait.c +++ b/arch/riscv/kernel/cpu_ops_spinwait.c @@ -18,7 +18,7 @@ void *__cpu_spinwait_task_pointer[NR_CPUS] __section(".data"); static void cpu_update_secondary_bootdata(unsigned int cpuid, struct task_struct *tidle) { - int hartid = cpuid_to_hartid_map(cpuid); + unsigned long hartid = cpuid_to_hartid_map(cpuid); /* * The hartid must be less than NR_CPUS to avoid out-of-bound access @@ -27,7 +27,7 @@ static void cpu_update_secondary_bootdata(unsigned int cpuid, * spinwait booting is not the recommended approach for any platforms * booting Linux in S-mode and can be disabled in the future. */ - if (hartid == INVALID_HARTID || hartid >= NR_CPUS) + if (hartid == INVALID_HARTID || hartid >= (unsigned long) NR_CPUS) return; /* Make sure tidle is updated */ |