Re: [PATCH v2 2/3] tcg: Return success from tcg_region_alloc

Yogesh Vyas <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <CAJOT6qNRduLyxkb1MbnUBWjaE2JdU6_ep3GzOwEVfrFubUPaxg@mail.gmail.com>
Regards,
Yogesh Vyas


On Thu, Aug 13, 2026 at 6:20 AM Richard Henderson <
[email protected]> wrote:

> Invert the sense of the boolean result from 'error' to 'success'.
>
> Signed-off-by: Richard Henderson <[email protected]>
> ---
>  tcg/region.c | 2 +-
>  tcg/tcg.c    | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tcg/region.c b/tcg/region.c
> index 2161d961d9..8ee8c39c43 100644
> --- a/tcg/region.c
> +++ b/tcg/region.c
> @@ -383,7 +383,7 @@ bool tcg_region_alloc(TCGContext *s)
>

The API comment above this function still says "return true on error" which
needs to be corrected with this patch.

         region.agg_size_full += size_full - TCG_HIGHWATER;
>      }
>      qemu_mutex_unlock(&region.lock);
> -    return !ok;
> +    return ok;
>  }
>
>  /*
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 1e77f2365a..af15c3d63e 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -1835,7 +1835,7 @@ TranslationBlock *tcg_tb_alloc(TCGContext *s)
>      next = (void *)ROUND_UP((uintptr_t)(tb + 1), align);
>
>      if (unlikely(next > s->code_gen_highwater)) {
> -        if (tcg_region_alloc(s)) {
> +        if (!tcg_region_alloc(s)) {
>              return NULL;
>          }
>          goto retry;
> --
> 2.43.0
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.