Skip to content

Commit

Permalink
RISC-V: Fix error code returned by riscv_hartid_to_cpuid()
Browse files Browse the repository at this point in the history
[ 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>
  • Loading branch information
avpatel authored and gregkh committed May 19, 2021
1 parent 0bfd913 commit 8eda58d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/riscv/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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)
Expand Down

0 comments on commit 8eda58d

Please sign in to comment.