diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0b47c8fd85114d7aec87d5a8d3ea88631bc70be5..dcaab0304c9ebfdc49243e60a360d9efd34cf988 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3838,7 +3838,7 @@ static void nvme_free_ctrl(struct device *dev) container_of(dev, struct nvme_ctrl, ctrl_device); struct nvme_subsystem *subsys = ctrl->subsys; - if (subsys && ctrl->instance != subsys->instance) + if (!subsys || ctrl->instance != subsys->instance) ida_simple_remove(&nvme_instance_ida, ctrl->instance); kfree(ctrl->effects);