aboutsummaryrefslogtreecommitdiff
path: root/hw/block/nvme.c
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2020-06-09 21:03:33 +0200
committerKevin Wolf <kwolf@redhat.com>2020-06-17 14:53:40 +0200
commit1c0c2163aa087c34efc7f84a8bc7e6640e3f6b75 (patch)
tree762ab9cb5545b39aa82c787e3a64018c99a8cc79 /hw/block/nvme.c
parent6a25a4b42e24df515e0e9a6b65683e500c66de73 (diff)
downloadqemu-1c0c2163aa087c34efc7f84a8bc7e6640e3f6b75.zip
qemu-1c0c2163aa087c34efc7f84a8bc7e6640e3f6b75.tar.gz
qemu-1c0c2163aa087c34efc7f84a8bc7e6640e3f6b75.tar.bz2
hw/block/nvme: verify msix_init_exclusive_bar() return value
Pass an Error to msix_init_exclusive_bar() and check it. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Message-Id: <20200609190333.59390-23-its@irrelevant.dk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/block/nvme.c')
-rw-r--r--hw/block/nvme.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index acc6dbc..2a2e43f 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1522,7 +1522,7 @@ static void nvme_init_pmr(NvmeCtrl *n, PCIDevice *pci_dev)
PCI_BASE_ADDRESS_MEM_PREFETCH, &n->pmrdev->mr);
}
-static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev)
+static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp)
{
uint8_t *pci_conf = pci_dev->config;
@@ -1535,7 +1535,9 @@ static void nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev)
n->reg_size);
pci_register_bar(pci_dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem);
- msix_init_exclusive_bar(pci_dev, n->params.msix_qsize, 4, NULL);
+ if (msix_init_exclusive_bar(pci_dev, n->params.msix_qsize, 4, errp)) {
+ return;
+ }
if (n->params.cmb_size_mb) {
nvme_init_cmb(n, pci_dev);
@@ -1603,7 +1605,12 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
return;
}
- nvme_init_pci(n, pci_dev);
+ nvme_init_pci(n, pci_dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+
nvme_init_ctrl(n, pci_dev);
for (i = 0; i < n->num_namespaces; i++) {