qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@gmail.com>
To: keith.busch@intel.com, kwolf@redhat.com, mreitz@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Li Qiang <liq3ea@gmail.com>
Subject: [Qemu-devel] [PATCH 3/4] nvme: check msix_init_exclusive_bar return value
Date: Mon, 29 Oct 2018 22:18:39 -0700	[thread overview]
Message-ID: <1540876720-9574-4-git-send-email-liq3ea@gmail.com> (raw)
In-Reply-To: <1540876720-9574-1-git-send-email-liq3ea@gmail.com>

As this function can fail.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/block/nvme.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 72c9644..a406c23 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1250,7 +1250,10 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
     pci_register_bar(&n->parent_obj, 0,
         PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64,
         &n->iomem);
-    msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4, NULL);
+    if (msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4, NULL)) {
+        error_setg(errp, "msix_init_exclusive_bar failed");
+        return;
+    }
 
     id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID));
     id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID));
-- 
1.8.3.1

  parent reply	other threads:[~2018-10-30  5:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30  5:18 [Qemu-devel] [PATCH 0/4] nvme: some small fixes Li Qiang
2018-10-30  5:18 ` [Qemu-devel] [PATCH 1/4] nvme: use TYPE_NVME instead of constant string Li Qiang
2019-01-09 14:39   ` Max Reitz
2018-10-30  5:18 ` [Qemu-devel] [PATCH 2/4] nvme: ensure the num_queues is not zero Li Qiang
2019-01-09 14:38   ` Max Reitz
2019-01-10  3:02     ` Li Qiang
2018-10-30  5:18 ` Li Qiang [this message]
2019-01-09 14:51   ` [Qemu-devel] [PATCH 3/4] nvme: check msix_init_exclusive_bar return value Max Reitz
2019-01-10  3:06     ` Li Qiang
2018-10-30  5:18 ` [Qemu-devel] [PATCH 4/4] nvme: use pci_dev directly in nvme_realize Li Qiang
2019-01-09 15:05   ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540876720-9574-4-git-send-email-liq3ea@gmail.com \
    --to=liq3ea@gmail.com \
    --cc=keith.busch@intel.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).