]> Git Repo - qemu.git/commitdiff
hw/block/nvme: verify msix_init_exclusive_bar() return value
authorKlaus Jensen <[email protected]>
Tue, 9 Jun 2020 19:03:33 +0000 (21:03 +0200)
committerKevin Wolf <[email protected]>
Wed, 17 Jun 2020 12:53:40 +0000 (14:53 +0200)
Pass an Error to msix_init_exclusive_bar() and check it.

Signed-off-by: Klaus Jensen <[email protected]>
Message-Id: <20200609190333[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
hw/block/nvme.c

index acc6dbc900e2cced46783fe1110f560017728eb0..2a2e43f681f97ee92489456ded1225db389a1941 100644 (file)
@@ -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++) {
This page took 0.029723 seconds and 4 git commands to generate.