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: Lance Hartmann <lance.hartmann@oracle.com> Reviewed-on: https://review.gerrithub.io/403588 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
abd86265d3
commit
5c36200d90
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user