From 7b02b402827e52446e0f1ac66056bc74f25af75a Mon Sep 17 00:00:00 2001 From: Cunyin Chang Date: Fri, 1 Dec 2017 08:34:38 +0800 Subject: [PATCH] bdev/malloc: unregister the malloc bdev when app exit. Change-Id: Ifca98f355b3a5ac65831843945cb2998429c6f59 Signed-off-by: Cunyin Chang Reviewed-on: https://review.gerrithub.io/389921 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/bdev/malloc/bdev_malloc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/bdev/malloc/bdev_malloc.c b/lib/bdev/malloc/bdev_malloc.c index b102fa10a9..9c5e4fb0b1 100644 --- a/lib/bdev/malloc/bdev_malloc.c +++ b/lib/bdev/malloc/bdev_malloc.c @@ -434,13 +434,6 @@ struct spdk_bdev *create_malloc_disk(const char *name, uint64_t num_blocks, uint return &mdisk->disk; } -static void free_malloc_disk(struct malloc_disk *mdisk) -{ - free(mdisk->disk.name); - spdk_dma_free(mdisk->malloc_buf); - spdk_dma_free(mdisk); -} - static int bdev_malloc_initialize(void) { struct spdk_conf_section *sp = spdk_conf_find_section(NULL, "Malloc"); @@ -483,7 +476,7 @@ static void bdev_malloc_finish(void) while (g_malloc_disk_head != NULL) { mdisk = g_malloc_disk_head; g_malloc_disk_head = mdisk->next; - free_malloc_disk(mdisk); + spdk_bdev_unregister(&mdisk->disk, NULL, NULL); } }