summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Maydell2021-02-11 16:32:28 +0100
committerPeter Maydell2021-02-11 16:32:28 +0100
commitc973f06521b07af0f82893b75a1d55562fffb4b5 (patch)
tree7741765af2d5b9ac0d2a1a1c9c0d33e81ac09a0e
parentMerge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request... (diff)
parenthw/block/nvme: fix error handling in nvme_ns_realize (diff)
downloadqemu-c973f06521b07af0f82893b75a1d55562fffb4b5.tar.gz
qemu-c973f06521b07af0f82893b75a1d55562fffb4b5.tar.xz
qemu-c973f06521b07af0f82893b75a1d55562fffb4b5.zip
Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-pull-request' into staging
Two small fixes for regressions reported by Alexander Graf and Bin Meng. v2: spotted one bug in the error handling. # gpg: Signature made Thu 11 Feb 2021 15:19:30 GMT # gpg: using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9 # gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [unknown] # gpg: aka "Klaus Jensen <k.jensen@samsung.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468 4272 63D5 6FC5 E55D A838 # Subkey fingerprint: 5228 33AA 75E2 DCE6 A247 66C0 4DE1 AF31 6D4F 0DE9 * remotes/nvme/tags/nvme-fixes-pull-request: hw/block/nvme: fix error handling in nvme_ns_realize hw/block/nvme: Fix a build error in nvme_get_feature() hw/block/nvme: fix legacy namespace registration Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/block/nvme-ns.c7
-rw-r--r--hw/block/nvme.c5
2 files changed, 6 insertions, 6 deletions
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;
+ }
}
}