nvme: Make nvme_init error handling code more readable
PATCH v2 1/1 nvme: Make nvme_init error handling code more readable
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 <[email protected]>
---
v2: Don't play stupid. [Peter]
--- block/nvme.c | 4 ++++ 1 file changed, 4 insertions(+)
block/nvme.c +4 -0
@@ -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 ;
Signature · 1 line
2.14.3
Fam Zheng
AppliedQuoted 4 lines · Fam Zheng
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 <[email protected]>
Queued, thanks.
Fam