Commit 5c36200d authored by Lance Hartmann's avatar Lance Hartmann Committed by Jim Harris
Browse files

lib: Return instead of abort() in nbd



Return NULL on resource failure (calloc) instead of
abort()'ing in static nbd function and check result
returning an errno, in that case, further up the call
chain.

Change-Id: If95f8db745fa77c76c415a1aa54c5338c270628f
Signed-off-by: default avatarLance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403588


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent abd86265
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -229,8 +229,7 @@ spdk_get_nbd_io(struct spdk_nbd_disk *nbd)

	io = calloc(1, sizeof(*io));
	if (!io) {
		SPDK_ERRLOG("Unable to get nbd_io\n");
		abort();
		return NULL;
	}

	io->nbd = nbd;
@@ -509,6 +508,9 @@ spdk_nbd_io_recv_internal(struct spdk_nbd_disk *nbd)

	if (nbd->io_in_recv == NULL) {
		nbd->io_in_recv = spdk_get_nbd_io(nbd);
		if (!nbd->io_in_recv) {
			return -ENOMEM;
		}
	}

	io = nbd->io_in_recv;