Skip to content

Commit

Permalink
nvme: Free ctrl device name on init failure
Browse files Browse the repository at this point in the history
Free the kobject name that was allocated for the controller device on
failure rather than its parent.

Fixes: d22524a ("nvme: switch controller refcounting to use struct device")
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Keith Busch authored and Christoph Hellwig committed Nov 27, 2018
1 parent 14b0406 commit d6a2b95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d6a2b95

Please sign in to comment.