summaryrefslogtreecommitdiff
path: root/lib/utils/timer
diff options
context:
space:
mode:
authorAnup Patel <[email protected]>2023-07-05 12:15:15 +0530
committerAnup Patel <[email protected]>2023-07-09 11:04:57 +0530
commitc6a35733b74aeff612398f274ed19a74f81d1f37 (patch)
tree36e2aacd2f501cc9c826f19a964198c91e14a47b /lib/utils/timer
parent7828eebaaa773fd83e63471ca27be3f30a0694f6 (diff)
lib: utils: Fix sbi_hartid_to_scratch() usage in ACLINT drivers
The cold_init() functions of ACLINT drivers should skip the HART if sbi_hartid_to_scratch() returns NULL because we might be dealing with a HART that is disabled in the device tree. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Xiang W <[email protected]>
Diffstat (limited to 'lib/utils/timer')
-rw-r--r--lib/utils/timer/aclint_mtimer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/utils/timer/aclint_mtimer.c b/lib/utils/timer/aclint_mtimer.c
index 13af5d82..271e6252 100644
--- a/lib/utils/timer/aclint_mtimer.c
+++ b/lib/utils/timer/aclint_mtimer.c
@@ -219,8 +219,13 @@ int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt,
/* Update MTIMER pointer in scratch space */
for (i = 0; i < mt->hart_count; i++) {
scratch = sbi_hartid_to_scratch(mt->first_hartid + i);
+ /*
+ * We don't need to fail if scratch pointer is not available
+ * because we might be dealing with hartid of a HART disabled
+ * in the device tree.
+ */
if (!scratch)
- return SBI_ENOENT;
+ continue;
mtimer_set_hart_data_ptr(scratch, mt);
}