tests/libqos: Add io_fw_cfg_uninit() and mm_fw_cfg_uninit()

The mm_fw_cfg_init() allocates a QFWCFG object,
add mm_fw_cfg_uninit() to deallocate it.
Similarly with io_fw_cfg_init(), add io_fw_cfg_uninit().

Signed-off-by: Li Qiang <liq3ea@163.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190424140643.62457-2-liq3ea@163.com>
[PMD: Split patch, filled commit description]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2019-04-22 11:57:30 +02:00
parent a2b45ea508
commit 0729d833d6
2 changed files with 12 additions and 0 deletions

View File

@ -81,6 +81,11 @@ QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base)
return fw_cfg;
}
void mm_fw_cfg_uninit(QFWCFG *fw_cfg)
{
g_free(fw_cfg);
}
static void io_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
{
qtest_outw(fw_cfg->qts, fw_cfg->base, key);
@ -107,3 +112,8 @@ QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base)
return fw_cfg;
}
void io_fw_cfg_uninit(QFWCFG *fw_cfg)
{
g_free(fw_cfg);
}

View File

@ -33,7 +33,9 @@ uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key);
uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key);
QFWCFG *mm_fw_cfg_init(QTestState *qts, uint64_t base);
void mm_fw_cfg_uninit(QFWCFG *fw_cfg);
QFWCFG *io_fw_cfg_init(QTestState *qts, uint16_t base);
void io_fw_cfg_uninit(QFWCFG *fw_cfg);
static inline QFWCFG *pc_fw_cfg_init(QTestState *qts)
{