Skip to contentSkip to conversation

nvme: Free ctrl device name on init failure

PATCH New Keith Busch 2 participants 2 messages Nov 26, 2018 – Nov 27, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Free ctrl device name on init failure

Free the kobject name that was allocated for the controller device on failure rather than its parent.

Fixes d22524a4782a9 ("nvme: switch controller refcounting to use struct device")
Signed-off-by Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index 559d567693b8..5afda6fe5ae9 100644
@@ -3585,7 +3585,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
 
 	return 0;
 out_free_name:
-	kfree_const(dev->kobj.name);
+	kfree_const(ctrl->device->kobj.name);
 out_release_instance:
 	ida_simple_remove(&nvme_instance_ida, ctrl->instance);
 out:
Signature · 1 line
2.14.4
maintainer Applied
#1 lore raw

PATCH 1/1 nvme: Free ctrl device name on init failure

Thanks,

applied to nvme-4.20.