Skip to content

Commit 533b4f3

Browse files
avpatelpalmer-dabbelt
authored andcommitted
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: 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 <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 2951162 commit 533b4f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/smp.c

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

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

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

0 commit comments

Comments
 (0)