diff --git a/opal/mca/btl/self/btl_self.c b/opal/mca/btl/self/btl_self.c index 0e8b5299d06..03b2389a5a8 100644 --- a/opal/mca/btl/self/btl_self.c +++ b/opal/mca/btl/self/btl_self.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2022 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -248,7 +248,9 @@ static int mca_btl_self_sendi(struct mca_btl_base_module_t *btl, frag = mca_btl_self_prepare_src(btl, endpoint, convertor, order, header_size, &payload_size, flags | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); if (NULL == frag) { - *descriptor = NULL; + if( NULL != descriptor ) { + *descriptor = NULL; + } return OPAL_ERR_OUT_OF_RESOURCE; } diff --git a/opal/mca/btl/smcuda/btl_smcuda.c b/opal/mca/btl/smcuda/btl_smcuda.c index 5784e79bdde..3baac9f39b7 100644 --- a/opal/mca/btl/smcuda/btl_smcuda.c +++ b/opal/mca/btl/smcuda/btl_smcuda.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2014 The University of Tennessee and The University + * Copyright (c) 2004-2022 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, @@ -876,11 +876,7 @@ int mca_btl_smcuda_sendi(struct mca_btl_base_module_t *btl, } /* We do not want to use this path when we have CUDA IPC support */ if ((convertor->flags & CONVERTOR_CUDA) && (IPC_ACKED == endpoint->ipcstate)) { - if (NULL != descriptor) { - *descriptor = mca_btl_smcuda_alloc(btl, endpoint, order, payload_size + header_size, - flags); - } - return OPAL_ERR_RESOURCE_BUSY; + goto return_resource_busy; } #endif /* OPAL_CUDA_SUPPORT */ @@ -942,8 +938,10 @@ int mca_btl_smcuda_sendi(struct mca_btl_base_module_t *btl, return OPAL_SUCCESS; } - /* presumably, this code path will never get executed */ - *descriptor = mca_btl_smcuda_alloc(btl, endpoint, order, payload_size + header_size, flags); + return_resource_busy: + if (NULL != descriptor) { + *descriptor = mca_btl_smcuda_alloc(btl, endpoint, order, payload_size + header_size, flags); + } return OPAL_ERR_RESOURCE_BUSY; }