Skip to content

Commit

Permalink
lib: sbi: system reset with invalid parameters
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xypron authored and avpatel committed Oct 18, 2021
1 parent c38973e commit 67cbbcb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sbi/sbi_ecall_replace.c
Expand Up @@ -151,15 +151,15 @@ static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid,
case SBI_SRST_RESET_TYPE_WARM_REBOOT:
break;
default:
return SBI_ENOTSUPP;
return SBI_EINVAL;
}

switch (regs->a1) {
case SBI_SRST_RESET_REASON_NONE:
case SBI_SRST_RESET_REASON_SYSFAIL:
break;
default:
return SBI_ENOTSUPP;
return SBI_EINVAL;
}

if (sbi_system_reset_supported(regs->a0, regs->a1))
Expand Down

0 comments on commit 67cbbcb

Please sign in to comment.