qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Thomas Huth <thuth@redhat.com>, Li Qiang <liq3ea@163.com>,
	Gerd Hoffmann <kraxel@redhat.com>
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	[thread overview]
Message-ID: <f7dc4d44-e867-9009-0f5e-1155280b667e@redhat.com> (raw)
In-Reply-To: <20190520213700.12620-3-philmd@redhat.com>

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 <liq3ea@163.com>
> Tested-by: Thomas Huth <thuth@redhat.com>
> Message-Id: <20190424140643.62457-2-liq3ea@163.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> [PMD: Split patch, fill commit description, call uninit in malloc-pc.c]
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  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 <lersek@redhat.com>

(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	other threads:[~2019-05-21  7:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 21:36 [Qemu-devel] [PATCH v3 0/7] fw_cfg_test refactor and add two test cases Philippe Mathieu-Daudé
2019-05-20 21:36 ` [Qemu-devel] [PATCH v3 1/7] tests/libqos: Add io_fw_cfg_uninit() and mm_fw_cfg_uninit() Philippe Mathieu-Daudé
2019-05-21  7:16   ` Laszlo Ersek
2019-05-20 21:36 ` [Qemu-devel] [PATCH v3 2/7] tests/libqos: Add pc_fw_cfg_uninit() and use it Philippe Mathieu-Daudé
2019-05-21  7:21   ` Laszlo Ersek [this message]
2019-05-20 21:36 ` [Qemu-devel] [PATCH v3 3/7] tests: refactor fw_cfg_test Philippe Mathieu-Daudé
2019-05-20 21:36 ` [Qemu-devel] [PATCH v3 4/7] tests: fw_cfg: add a function to get the fw_cfg file Philippe Mathieu-Daudé
2019-05-20 21:36 ` [Qemu-devel] [PATCH v3 5/7] hw/nvram/fw_cfg: Store 'reboot-timeout' as little endian Philippe Mathieu-Daudé
2019-05-20 21:36 ` [Qemu-devel] [PATCH v3 6/7] tests: fw_cfg: add 'reboot-timeout' test case Philippe Mathieu-Daudé
2019-05-20 21:37 ` [Qemu-devel] [PATCH v3 7/7] tests: fw_cfg: add 'splash-time' " Philippe Mathieu-Daudé
2019-05-22 14:07 ` [Qemu-devel] [PATCH v3 0/7] fw_cfg_test refactor and add two test cases Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7dc4d44-e867-9009-0f5e-1155280b667e@redhat.com \
    --to=lersek@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=liq3ea@163.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).