lib: sbi: system reset with invalid parameters

The SBI specification requires that sbi_system_reset() returns
SBI_ERR_INVALID_PARAM if reset_type or reset_reason are not valid.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
Heinrich Schuchardt
2021-10-15 15:42:21 +02:00
committed by Anup Patel
parent c38973e087
commit 67cbbcb100

View File

@@ -151,7 +151,7 @@ static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid,
case SBI_SRST_RESET_TYPE_WARM_REBOOT: case SBI_SRST_RESET_TYPE_WARM_REBOOT:
break; break;
default: default:
return SBI_ENOTSUPP; return SBI_EINVAL;
} }
switch (regs->a1) { switch (regs->a1) {
@@ -159,7 +159,7 @@ static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid,
case SBI_SRST_RESET_REASON_SYSFAIL: case SBI_SRST_RESET_REASON_SYSFAIL:
break; break;
default: default:
return SBI_ENOTSUPP; return SBI_EINVAL;
} }
if (sbi_system_reset_supported(regs->a0, regs->a1)) if (sbi_system_reset_supported(regs->a0, regs->a1))