diff mbox series

[RFC,v2,05/11] lib: sbi: Fix error codes returned by HSM start() and stop() functions

Message ID 20210224103203.246229-6-anup.patel@wdc.com
State Superseded
Headers show
Series SBI HSM suspend implementation | expand

Commit Message

Anup Patel Feb. 24, 2021, 10:31 a.m. UTC
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>
---
 lib/sbi/sbi_hsm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Atish Patra March 2, 2021, 6:18 a.m. UTC | #1
On Wed, Feb 24, 2021 at 2:32 AM Anup Patel <anup.patel@wdc.com> wrote:
>
> 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>
> ---
>  lib/sbi/sbi_hsm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
> index 10099c2..63fa8c2 100644
> --- a/lib/sbi/sbi_hsm.c
> +++ b/lib/sbi/sbi_hsm.c
> @@ -202,7 +202,7 @@ int sbi_hsm_hart_start(struct sbi_scratch *scratch,
>                 return SBI_EINVAL;
>         if (dom && !sbi_domain_check_addr(dom, saddr, smode,
>                                           SBI_DOMAIN_EXECUTE))
> -               return SBI_EINVAL;
> +               return SBI_EINVALID_ADDR;
>
>         rscratch = sbi_hartid_to_scratch(hartid);
>         if (!rscratch)
> @@ -251,7 +251,7 @@ int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow)
>         if (oldstate != SBI_HSM_STATE_STARTED) {
>                 sbi_printf("%s: ERR: The hart is in invalid state [%u]\n",
>                            __func__, oldstate);
> -               return SBI_EDENIED;
> +               return SBI_EFAIL;
>         }
>
>         if (exitnow)
> --
> 2.25.1
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


Reviewed-by: Atish Patra <atish.patra@wdc.com>
diff mbox series

Patch

diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index 10099c2..63fa8c2 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -202,7 +202,7 @@  int sbi_hsm_hart_start(struct sbi_scratch *scratch,
 		return SBI_EINVAL;
 	if (dom && !sbi_domain_check_addr(dom, saddr, smode,
 					  SBI_DOMAIN_EXECUTE))
-		return SBI_EINVAL;
+		return SBI_EINVALID_ADDR;
 
 	rscratch = sbi_hartid_to_scratch(hartid);
 	if (!rscratch)
@@ -251,7 +251,7 @@  int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow)
 	if (oldstate != SBI_HSM_STATE_STARTED) {
 		sbi_printf("%s: ERR: The hart is in invalid state [%u]\n",
 			   __func__, oldstate);
-		return SBI_EDENIED;
+		return SBI_EFAIL;
 	}
 
 	if (exitnow)