]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:08:26 +0000 (10:08 +0200)
commitb8168792c3fb42136134f6cfee880f4ef2469221
tree98b98209858c48508579de646f14df52c4695ced
parentb1b31948c0af44628e43353828453461bb74098f
RISC-V: Fix error code returned by riscv_hartid_to_cpuid()

[ Upstream commit 533b4f3a789d49574e7ae0f6ececed153f651f97 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/kernel/smp.c