Skip to contentSkip to conversation

NVMe: nvme_core_exit() should do cleanup in the reverse order as nvme_core_init does

PATCH New Wang Sheng-Hui 3 participants 4 messages Apr 28, 2016 – May 2, 2016 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NVMe: nvme_core_exit() should do cleanup in the reverse order as nvme_core_init does

nvme_core_init does:
1) register_blkdev
2) __register_chrdev
3) class_create

nvme_core_exit should do cleanup in the reverse order.

Signed-off-by Wang Sheng-Hui <shhuiw at foxmail.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index 643f457..49bc4c0 100644
@@ -1607,9 +1607,9 @@ int __init nvme_core_init(void)
 
 void nvme_core_exit(void)
 {
-	unregister_blkdev(nvme_major, "nvme");
 	class_destroy(nvme_class);
 	__unregister_chrdev(nvme_char_major, 0, NVME_MINORS, "nvme");
+	unregister_blkdev(nvme_major, "nvme");
 }
 
 MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 NVMe: nvme_core_exit() should do cleanup in the reverse order as nvme_core_init does

Quoted 6 lines · Wang Sheng-Hui

nvme_core_init does:
1) register_blkdev
2) __register_chrdev
3) class_create

nvme_core_exit should do cleanup in the reverse order.

Not sure why this would matter, but it looks correct to me:

Reviewed-by Christoph Hellwig <hch at lst.de>
#2 lore raw

PATCH 1/1 NVMe: nvme_core_exit() should do cleanup in the reverseorder as nvme_core_init does

Christoph,

The order of the statements doesn't impact current implementation. No dependance between the data structures referred in each step. It's kind of code cleanup.

Regards,
Wang Sheng-Hui

------------------ Original ------------------

From:  "Christoph Hellwig";<[email protected]>;
Date:  Mon, May 2, 2016 02:05 AM
To:  "Wang Sheng-Hui"<shhuiw at foxmail.com>; 

Cc: "keith.busch"<keith.busch at intel.com>; "axboe"<axboe at fb.com>; "linux-nvme"<linux-nvme at lists.infradead.org>;
Subject: Re: [PATCH] NVMe: nvme_core_exit() should do cleanup in the reverseorder as nvme_core_init does

Quoted 6 lines · Wang Sheng-Hui

nvme_core_init does:
1) register_blkdev
2) __register_chrdev
3) class_create

nvme_core_exit should do cleanup in the reverse order.

Not sure why this would matter, but it looks correct to me:

Reviewed-by Christoph Hellwig <hch at lst.de>

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw

PATCH 1/1 NVMe: nvme_core_exit() should do cleanup in the reverse order as nvme_core_init does

In reply to Wang Sheng-Hui
Quoted 6 lines · Wang Sheng-Hui

nvme_core_init does:
1) register_blkdev
2) __register_chrdev
3) class_create

nvme_core_exit should do cleanup in the reverse order.

Added for 4.7.

Signature · 1 line
Jens Axboe