Skip to content

Commit 208af7f

Browse files
avpatelgregkh
authored andcommitted
RISC-V: Fix error code returned by riscv_hartid_to_cpuid()
[ Upstream commit 533b4f3 ] 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: 6825c7a ("RISC-V: Add logical CPU indexing for RISC-V") Fixes: f99fb60 ("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>
1 parent f01988e commit 208af7f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/riscv/kernel/smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int riscv_hartid_to_cpuid(int hartid)
5454
return i;
5555

5656
pr_err("Couldn't find cpu id for hartid [%d]\n", hartid);
57-
return i;
57+
return -ENOENT;
5858
}
5959

6060
void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out)

0 commit comments

Comments
 (0)