qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] nvme: Make nvme_init error handling code more readable
@ 2018-05-21  8:58 Fam Zheng
  2018-05-24  7:46 ` Fam Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2018-05-21  8:58 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, qemu-block, Fam Zheng, Kevin Wolf, Max Reitz,
	pbonzini

Coverity doesn't like the tests under fail label (report CID 1385847).
Reset the fields so the clean up order is more apparent.

Signed-off-by: Fam Zheng <famz@redhat.com>

---

v2: Don't play stupid. [Peter]
---
 block/nvme.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block/nvme.c b/block/nvme.c
index 6f71122bf5..c2eb9e2a4e 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -566,6 +566,10 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
         return ret;
     }
 
+    /* Fields we've not touched should be zero-initialized by block layer
+     * already, but reset it anyway to make the error handling code easier to
+     * reason. */
+    s->regs = NULL;
     s->vfio = qemu_vfio_open_pci(device, errp);
     if (!s->vfio) {
         ret = -EINVAL;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH v2] nvme: Make nvme_init error handling code more readable
  2018-05-21  8:58 [Qemu-devel] [PATCH v2] nvme: Make nvme_init error handling code more readable Fam Zheng
@ 2018-05-24  7:46 ` Fam Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Fam Zheng @ 2018-05-24  7:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, qemu-block, Kevin Wolf, Max Reitz, pbonzini

On Mon, 05/21 16:58, Fam Zheng wrote:
> Coverity doesn't like the tests under fail label (report CID 1385847).
> Reset the fields so the clean up order is more apparent.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Queued, thanks.

Fam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-24  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-21  8:58 [Qemu-devel] [PATCH v2] nvme: Make nvme_init error handling code more readable Fam Zheng
2018-05-24  7:46 ` Fam Zheng

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).