ACRN: DM: Free the console in the unify API

Use the teardown API as the unify free console API in virtio console,
in case the console have already been freed by deinit when the teardwon
API is called.

Tracked-On: #6157
Signed-off-by: Liu Long <long.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Long Liu
2021-06-08 13:57:21 +08:00
committed by wenlingz
parent 24af7f8f9d
commit 8d81914350

View File

@@ -1020,24 +1020,13 @@ virtio_console_destroy(struct virtio_console *console)
static void
virtio_console_teardown_backend(void *param)
{
struct virtio_console *console = NULL;
struct virtio_console_backend *be;
be = (struct virtio_console_backend *)param;
if (!be)
return;
if (be->port)
console = be->port->console;
virtio_console_close_backend(be);
if (console) {
console->ref_count--;
/* free virtio_console if this is the last backend */
if (console->ref_count == 0)
virtio_console_destroy(console);
}
}
static int