RISC-V: Fix error code returned by riscv_hartid_to_cpuid()
authorAnup Patel <anup.patel@wdc.com>
Thu, 15 Apr 2021 08:55:22 +0000 (14:25 +0530)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 1 May 2021 15:53:19 +0000 (08:53 -0700)
commit533b4f3a789d49574e7ae0f6ececed153f651f97
treebb99835bd7b2348a2d0cca7b26ccd3f70ae96b56
parent2951162094e61f574b0ddf886c783ace65049450
RISC-V: Fix error code returned by riscv_hartid_to_cpuid()

We should return a negative error code upon failure in
riscv_hartid_to_cpuid() instead of NR_CPUS. This is also
aligned with all uses of riscv_hartid_to_cpuid() which
expect negative error code upon failure.

Fixes: 6825c7a80f18 ("RISC-V: Add logical CPU indexing for RISC-V")
Fixes: f99fb607fb2b ("RISC-V: Use Linux logical CPU number instead of hartid")
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/smp.c