diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index dfed71a950..93ac6e107a 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block/nvme-ns.c @@ -358,17 +358,12 @@ static void nvme_ns_realize(DeviceState *dev, Error **errp) NvmeNamespace *ns = NVME_NS(dev); BusState *s = qdev_get_parent_bus(dev); NvmeCtrl *n = NVME(s->parent); - Error *local_err = NULL; - if (nvme_ns_setup(ns, &local_err)) { - error_propagate_prepend(errp, local_err, - "could not setup namespace: "); + if (nvme_ns_setup(ns, errp)) { return; } if (nvme_register_namespace(n, ns, errp)) { - error_propagate_prepend(errp, local_err, - "could not register namespace: "); return; } diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 5ce21b7100..fb83636abd 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -3228,6 +3228,7 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeRequest *req) result = ns->features.err_rec; goto out; case NVME_VOLATILE_WRITE_CACHE: + result = 0; for (i = 1; i <= n->num_namespaces; i++) { ns = nvme_ns(n, i); if (!ns) { @@ -4507,6 +4508,10 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp) if (nvme_ns_setup(ns, errp)) { return; } + + if (nvme_register_namespace(n, ns, errp)) { + return; + } } }