lib: sbi: Fix error codes returned by HSM start() and stop() functions

The sbi_hsm_hart_start() and sbi_hsm_hart_stop() functions should
only return error codes as defined by the SBI specification.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Anup Patel
2021-02-24 15:26:44 +05:30
committed by Anup Patel
parent 638c948ab9
commit ca864a978d

View File

@@ -202,7 +202,7 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,
return SBI_EINVAL; return SBI_EINVAL;
if (dom && !sbi_domain_check_addr(dom, saddr, smode, if (dom && !sbi_domain_check_addr(dom, saddr, smode,
SBI_DOMAIN_EXECUTE)) SBI_DOMAIN_EXECUTE))
return SBI_EINVAL; return SBI_EINVALID_ADDR;
rscratch = sbi_hartid_to_scratch(hartid); rscratch = sbi_hartid_to_scratch(hartid);
if (!rscratch) if (!rscratch)
@@ -251,7 +251,7 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow)
if (oldstate != SBI_HSM_STATE_STARTED) { if (oldstate != SBI_HSM_STATE_STARTED) {
sbi_printf("%s: ERR: The hart is in invalid state [%u]\n", sbi_printf("%s: ERR: The hart is in invalid state [%u]\n",
__func__, oldstate); __func__, oldstate);
return SBI_EDENIED; return SBI_EFAIL;
} }
if (exitnow) if (exitnow)