]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RISC-V: Allow hartid-to-cpuid function to fail.
authorAtish Patra <atish.patra@wdc.com>
Fri, 22 Feb 2019 19:41:38 +0000 (11:41 -0800)
committerPalmer Dabbelt <palmer@sifive.com>
Mon, 4 Mar 2019 18:40:39 +0000 (10:40 -0800)
It is perfectly okay to call riscv_hartid_to_cpuid for a hartid that is
not mapped with an CPU id. It can happen if the calling functions
retrieves the hartid from DT.  However, that hartid was never brought
online by the firmware or kernel for any reasons.

No need to BUG() in the above case. A negative error return is
sufficient and the calling function should check for the return value
always.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
arch/riscv/kernel/smp.c

index b69883c61f3e8bc48e6fd0d14b898114a62b33ad..ca99f0fb49b169e3b0d1b02625e8e25de747052d 100644 (file)
@@ -60,7 +60,6 @@ int riscv_hartid_to_cpuid(int hartid)
                        return i;
 
        pr_err("Couldn't find cpu id for hartid [%d]\n", hartid);
-       BUG();
        return i;
 }