[PATCH 3/3] nvme: free subsystem device name when releasing subsystem

Guan Junxiong guanjunxiong at huawei.com
Mon Jan 15 21:06:33 PST 2018


We need to free the memory as the way we do in the nvme_init_ctrl
because the dev_set_name helper allocates memory for device name.

Signed-off-by: Guan Junxiong <guanjunxiong at huawei.com>
---
 drivers/nvme/host/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 5ada879..70ee889 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1961,6 +1961,7 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
 static void __nvme_release_subsystem(struct nvme_subsystem *subsys)
 {
 	ida_simple_remove(&nvme_subsystems_ida, subsys->instance);
+	kfree_const(subsys->dev.kobj.name);
 	kfree(subsys);
 }
 
-- 
2.6.4.windows.1





More information about the Linux-nvme mailing list