summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-04-15 11:55:22 +0300
committerPalmer Dabbelt <palmerdabbelt@google.com>2021-05-01 18:53:19 +0300
commit533b4f3a789d49574e7ae0f6ececed153f651f97 (patch)
treebb99835bd7b2348a2d0cca7b26ccd3f70ae96b56 /arch
parent2951162094e61f574b0ddf886c783ace65049450 (diff)
downloadlinux-533b4f3a789d49574e7ae0f6ececed153f651f97.tar.xz
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/riscv/kernel/smp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
index 366cb87c0e2e..921d9d7df400 100644
--- a/arch/riscv/kernel/smp.c
+++ b/arch/riscv/kernel/smp.c
@@ -56,7 +56,7 @@ int riscv_hartid_to_cpuid(int hartid)
return i;
pr_err("Couldn't find cpu id for hartid [%d]\n", hartid);
- return i;
+ return -ENOENT;
}
void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out)