From 53f86e2412e83c561186dd3a18d49d037ec3ba5d Mon Sep 17 00:00:00 2001 From: wuzhouhui Date: Fri, 10 Aug 2018 18:04:46 +0800 Subject: [PATCH] vhost/blk: spdk_vhost_blk_construct(): do not override errno returned We need these errno to make outputs more clear and make spdk_vhost_blk_construct() conforms to it's declaration. Change-Id: I1936e7393494a0344d97c8a920f3d719dee27002 Signed-off-by: wuzhouhui Reviewed-on: https://review.gerrithub.io/421859 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Jim Harris Chandler-Test-Pool: SPDK Automated Test System --- lib/vhost/vhost_blk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c index a105b503fb..36e5bd9fec 100644 --- a/lib/vhost/vhost_blk.c +++ b/lib/vhost/vhost_blk.c @@ -777,13 +777,13 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_ if (bdev == NULL) { SPDK_ERRLOG("Controller %s: bdev '%s' not found\n", name, dev_name); - ret = -1; + ret = -ENODEV; goto out; } bvdev = spdk_dma_zmalloc(sizeof(*bvdev), SPDK_CACHE_LINE_SIZE, NULL); if (bvdev == NULL) { - ret = -1; + ret = -ENOMEM; goto out; } @@ -791,7 +791,6 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_ if (ret != 0) { SPDK_ERRLOG("Controller %s: could not open bdev '%s', error=%d\n", name, dev_name, ret); - ret = -1; goto out; } @@ -800,7 +799,6 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_ ret = spdk_vhost_dev_register(&bvdev->vdev, name, cpumask, &vhost_blk_device_backend); if (ret != 0) { spdk_bdev_close(bvdev->bdev_desc); - ret = -1; goto out; }