diff mbox series

[1/1] lib: sbi: system reset with invalid parameters

Message ID 20211015134221.35427-1-heinrich.schuchardt@canonical.com
State Accepted
Headers show
Series [1/1] lib: sbi: system reset with invalid parameters | expand

Commit Message

Heinrich Schuchardt Oct. 15, 2021, 1:42 p.m. UTC
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>
---
 lib/sbi/sbi_ecall_replace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Atish Patra Oct. 15, 2021, 7:47 p.m. UTC | #1
On Fri, Oct 15, 2021 at 7:12 AM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> 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>
> ---
>  lib/sbi/sbi_ecall_replace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/sbi/sbi_ecall_replace.c b/lib/sbi/sbi_ecall_replace.c
> index 5d24565..93f44da 100644
> --- a/lib/sbi/sbi_ecall_replace.c
> +++ b/lib/sbi/sbi_ecall_replace.c
> @@ -151,7 +151,7 @@ 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) {
> @@ -159,7 +159,7 @@ static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid,
>                 case SBI_SRST_RESET_REASON_SYSFAIL:
>                         break;
>                 default:
> -                       return SBI_ENOTSUPP;
> +                       return SBI_EINVAL;
>                 }
>
>                 if (sbi_system_reset_supported(regs->a0, regs->a1))
> --
> 2.32.0
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


Reviewed-by: Atish Patra <atish.patra@wdc.com>
Xiang W Oct. 16, 2021, 7:13 a.m. UTC | #2
在 2021-10-15星期五的 15:42 +0200,Heinrich Schuchardt写道:
> 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: Xiang W <wxjstz@126.com>
> ---
>  lib/sbi/sbi_ecall_replace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/sbi/sbi_ecall_replace.c
> b/lib/sbi/sbi_ecall_replace.c
> index 5d24565..93f44da 100644
> --- a/lib/sbi/sbi_ecall_replace.c
> +++ b/lib/sbi/sbi_ecall_replace.c
> @@ -151,7 +151,7 @@ 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) {
> @@ -159,7 +159,7 @@ static int sbi_ecall_srst_handler(unsigned long
> extid, unsigned long funcid,
>                 case SBI_SRST_RESET_REASON_SYSFAIL:
>                         break;
>                 default:
> -                       return SBI_ENOTSUPP;
> +                       return SBI_EINVAL;
>                 }
>  
>                 if (sbi_system_reset_supported(regs->a0, regs->a1))
> -- 
> 2.32.0
> 
>
Anup Patel Oct. 18, 2021, 10:38 a.m. UTC | #3
On Sat, Oct 16, 2021 at 12:44 PM Xiang W <wxjstz@126.com> wrote:
>
> 在 2021-10-15星期五的 15:42 +0200,Heinrich Schuchardt写道:
> > 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: Xiang W <wxjstz@126.com>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> > ---
> >  lib/sbi/sbi_ecall_replace.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/sbi/sbi_ecall_replace.c
> > b/lib/sbi/sbi_ecall_replace.c
> > index 5d24565..93f44da 100644
> > --- a/lib/sbi/sbi_ecall_replace.c
> > +++ b/lib/sbi/sbi_ecall_replace.c
> > @@ -151,7 +151,7 @@ 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) {
> > @@ -159,7 +159,7 @@ static int sbi_ecall_srst_handler(unsigned long
> > extid, unsigned long funcid,
> >                 case SBI_SRST_RESET_REASON_SYSFAIL:
> >                         break;
> >                 default:
> > -                       return SBI_ENOTSUPP;
> > +                       return SBI_EINVAL;
> >                 }
> >
> >                 if (sbi_system_reset_supported(regs->a0, regs->a1))
> > --
> > 2.32.0
> >
> >
>
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
diff mbox series

Patch

diff --git a/lib/sbi/sbi_ecall_replace.c b/lib/sbi/sbi_ecall_replace.c
index 5d24565..93f44da 100644
--- a/lib/sbi/sbi_ecall_replace.c
+++ b/lib/sbi/sbi_ecall_replace.c
@@ -151,7 +151,7 @@  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) {
@@ -159,7 +159,7 @@  static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid,
 		case SBI_SRST_RESET_REASON_SYSFAIL:
 			break;
 		default:
-			return SBI_ENOTSUPP;
+			return SBI_EINVAL;
 		}
 
 		if (sbi_system_reset_supported(regs->a0, regs->a1))