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>
This commit is contained in:
Anup Patel
2020-03-14 18:55:53 +05:30
committed by Anup Patel
parent 3ebfe0ec5d
commit 209134d8f9
6 changed files with 29 additions and 8 deletions

View File

@@ -72,6 +72,8 @@ done:
plat = sbi_platform_ptr(scratch);
for (i = 0; i < sbi_platform_hart_count(plat); i++) {
rscratch = sbi_hartid_to_scratch(i);
if (!rscratch)
continue;
ptr = sbi_scratch_offset_ptr(rscratch, ret);
sbi_memset(ptr, 0, size);
}