qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/7] tests/libqos: Add pc_fw_cfg_uninit() and


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH v3 2/7] tests/libqos: Add pc_fw_cfg_uninit() and use it
Date: Tue, 21 May 2019 09:21:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 05/20/19 23:36, Philippe Mathieu-Daudé wrote:
> The pc_fw_cfg_init() function allocates an IO QFWCFG object.
> Add the pc_fw_cfg_uninit() function to deallocate it (and use it).
> 
> Signed-off-by: Li Qiang <address@hidden>
> Tested-by: Thomas Huth <address@hidden>
> Message-Id: <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> Tested-by: Philippe Mathieu-Daudé <address@hidden>
> [PMD: Split patch, fill commit description, call uninit in malloc-pc.c]
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  tests/fw_cfg-test.c      | 1 +
>  tests/libqos/fw_cfg.h    | 5 +++++
>  tests/libqos/malloc-pc.c | 2 +-
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
> index 1c5103fe1c5..a370ad56678 100644
> --- a/tests/fw_cfg-test.c
> +++ b/tests/fw_cfg-test.c
> @@ -128,6 +128,7 @@ int main(int argc, char **argv)
>  
>      ret = g_test_run();
>  
> +    pc_fw_cfg_uninit(fw_cfg);
>      qtest_quit(s);
>  
>      return ret;
> diff --git a/tests/libqos/fw_cfg.h b/tests/libqos/fw_cfg.h
> index 391669031a3..60de81e8633 100644
> --- a/tests/libqos/fw_cfg.h
> +++ b/tests/libqos/fw_cfg.h
> @@ -42,4 +42,9 @@ static inline QFWCFG *pc_fw_cfg_init(QTestState *qts)
>      return io_fw_cfg_init(qts, 0x510);
>  }
>  
> +static inline void pc_fw_cfg_uninit(QFWCFG *fw_cfg)
> +{
> +    io_fw_cfg_uninit(fw_cfg);
> +}
> +
>  #endif
> diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c
> index 949a99361d1..6f92ce41350 100644
> --- a/tests/libqos/malloc-pc.c
> +++ b/tests/libqos/malloc-pc.c
> @@ -29,5 +29,5 @@ void pc_alloc_init(QGuestAllocator *s, QTestState *qts, 
> QAllocOpts flags)
>      alloc_init(s, flags, 1 << 20, MIN(ram_size, 0xE0000000), PAGE_SIZE);
>  
>      /* clean-up */
> -    g_free(fw_cfg);
> +    pc_fw_cfg_uninit(fw_cfg);
>  }
> 

The 2nd part of the patch is a refactoring, but the first patch adds a
brand new g_free(), in effect. I think it would be better to separate
them -- in theory anyway. But I realize this patch is already the result
of splitting another patch. I guess we wouldn't want an army of 1-liner
patches...

If you split this patch even further, that's great, you can add my R-b
to both resultant patches. If you decide to keep it as-is, you can also
add my

Reviewed-by: Laszlo Ersek <address@hidden>

(I'm going to skip the rest of the patches, as they are from Li Qiang,
and you reviewed them already, without implementing changes on top, IIUC.)

Thanks
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]