hw/nvme: unregister controller with subsystem at exit
Make sure the controller is unregistered from the subsystem when device is removed. Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
cc6fb6bc50
commit
b0fde9e861
@ -6523,6 +6523,10 @@ static void nvme_exit(PCIDevice *pci_dev)
|
||||
nvme_ns_cleanup(ns);
|
||||
}
|
||||
|
||||
if (n->subsys) {
|
||||
nvme_subsys_unregister_ctrl(n->subsys, n);
|
||||
}
|
||||
|
||||
g_free(n->cq);
|
||||
g_free(n->sq);
|
||||
g_free(n->aer_reqs);
|
||||
|
@ -50,6 +50,7 @@ typedef struct NvmeSubsystem {
|
||||
} NvmeSubsystem;
|
||||
|
||||
int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp);
|
||||
void nvme_subsys_unregister_ctrl(NvmeSubsystem *subsys, NvmeCtrl *n);
|
||||
|
||||
static inline NvmeCtrl *nvme_subsys_ctrl(NvmeSubsystem *subsys,
|
||||
uint32_t cntlid)
|
||||
|
@ -32,6 +32,11 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
|
||||
return cntlid;
|
||||
}
|
||||
|
||||
void nvme_subsys_unregister_ctrl(NvmeSubsystem *subsys, NvmeCtrl *n)
|
||||
{
|
||||
subsys->ctrls[n->cntlid] = NULL;
|
||||
}
|
||||
|
||||
static void nvme_subsys_setup(NvmeSubsystem *subsys)
|
||||
{
|
||||
const char *nqn = subsys->params.nqn ?
|
||||
|
Loading…
Reference in New Issue
Block a user