Re: [kvm-unit-tests PATCH v2 1/2] s390x: Remove assert from arch_def.h

Claudio Imbrenda
2021-10-05T12:46:31Z

On Tue, 5 Oct 2021 11:11:52 +0200
Janis Schoetterl-Glausch <scgl@linux.ibm.com> wrote:

> Do not use asserts in arch_def.h so it can be included by snippets.
> The caller in stsi.c does not need to be adjusted, returning -1 causes
> the test to fail.
>
> Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
> lib/s390x/asm/arch_def.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 302ef1f..4167e2b 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -334,7 +334,7 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2)
> return cc;
> }
>
> -static inline unsigned long stsi_get_fc(void)
> +static inline int stsi_get_fc(void)
> {
> register unsigned long r0 asm("0") = 0;
> register unsigned long r1 asm("1") = 0;
> @@ -346,7 +346,8 @@ static inline unsigned long stsi_get_fc(void)
> : "+d" (r0), [cc] "=d" (cc)
> : "d" (r1)
> : "cc", "memory");
> - assert(!cc);
> + if (cc != 0)
> + return -1;
> return r0 >> 28;
> }
>