diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-03-14 18:55:53 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-19 09:11:12 +0530 |
commit | 209134d8f9c6e4ec9a555a7813f7e2c004b5b2d7 (patch) | |
tree | 8c9cda3f1891a2bc9f0e1b33c696f58806799335 /lib/sbi/sbi_tlb.c | |
parent | 3ebfe0ec5d280b0c5ca61b8c5cfe4bc807907630 (diff) |
lib: Handle failure of sbi_hartid_to_scratch() API
The sbi_hartid_to_scratch() API can fail for non-existent HARTs so
all uses of sbi_hartid_to_scratch() API should check return value.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_tlb.c')
-rw-r--r-- | lib/sbi/sbi_tlb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c index aab0d87..1b66fdf 100644 --- a/lib/sbi/sbi_tlb.c +++ b/lib/sbi/sbi_tlb.c @@ -197,6 +197,9 @@ static void sbi_tlb_entry_process(struct sbi_tlb_info *tinfo) sbi_hartmask_for_each_hart(rhartid, &tinfo->smask) { rscratch = sbi_hartid_to_scratch(rhartid); + if (!rscratch) + continue; + rtlb_sync = sbi_scratch_offset_ptr(rscratch, tlb_sync_off); while (atomic_raw_xchg_ulong(rtlb_sync, 1)) ; } |