Skip to content

Commit

Permalink
Fix Coverity issue: dead code in bindless image validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongreig committed Jun 15, 2023
1 parent 7b96d40 commit 2ee83ed
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 36 deletions.
10 changes: 4 additions & 6 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -6366,23 +6366,21 @@ urBindlessImagesImageCopyExp(
/// + `NULL == hImageMem`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_IMAGE_INFO_DEPTH < propName`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pPropValue`
/// + `NULL == pPropSizeRet`
/// + `pPropValue == NULL && pPropSizeRet == NULL`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + If `propSize` is less than the real number of bytes needed to return the info.
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `pPropValue == NULL && pPropSizeRet == NULL`
/// - ::UR_RESULT_ERROR_INVALID_DEVICE
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
UR_APIEXPORT ur_result_t UR_APICALL
urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
);

///////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,10 @@ params:
desc: "[in] queried info name"
- type: void*
name: pPropValue
desc: "[out] returned query value"
desc: "[out][optional] returned query value"
- type: "size_t*"
name: pPropSizeRet
desc: "[out] returned query value size"
desc: "[out][optional] returned query value size"
returns:
- $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION:
- "If `propName` is not supported by the adapter."
Expand Down
4 changes: 2 additions & 2 deletions source/adapters/null/ur_nullddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3740,8 +3740,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
) try {
ur_result_t result = UR_RESULT_SUCCESS;

Expand Down
4 changes: 2 additions & 2 deletions source/loader/layers/tracing/ur_trcddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4246,8 +4246,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
) {
auto pfnImageGetInfoExp =
context.urDdiTable.BindlessImagesExp.pfnImageGetInfoExp;
Expand Down
12 changes: 2 additions & 10 deletions source/loader/layers/validation/ur_valddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5396,8 +5396,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
) {
auto pfnImageGetInfoExp =
context.urDdiTable.BindlessImagesExp.pfnImageGetInfoExp;
Expand All @@ -5411,14 +5411,6 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
return UR_RESULT_ERROR_INVALID_NULL_HANDLE;
}

if (NULL == pPropValue) {
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}

if (NULL == pPropSizeRet) {
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}

if (pPropValue == NULL && pPropSizeRet == NULL) {
return UR_RESULT_ERROR_INVALID_NULL_POINTER;
}
Expand Down
4 changes: 2 additions & 2 deletions source/loader/ur_ldrddi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5234,8 +5234,8 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
__urdlllocal ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
) {
ur_result_t result = UR_RESULT_SUCCESS;

Expand Down
10 changes: 4 additions & 6 deletions source/loader/ur_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5649,22 +5649,20 @@ ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
/// + `NULL == hImageMem`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_IMAGE_INFO_DEPTH < propName`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pPropValue`
/// + `NULL == pPropSizeRet`
/// + `pPropValue == NULL && pPropSizeRet == NULL`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + If `propSize` is less than the real number of bytes needed to return the info.
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `pPropValue == NULL && pPropSizeRet == NULL`
/// - ::UR_RESULT_ERROR_INVALID_DEVICE
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
) try {
auto pfnImageGetInfoExp =
ur_lib::context->urDdiTable.BindlessImagesExp.pfnImageGetInfoExp;
Expand Down
10 changes: 4 additions & 6 deletions source/ur_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4758,22 +4758,20 @@ ur_result_t UR_APICALL urBindlessImagesImageCopyExp(
/// + `NULL == hImageMem`
/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION
/// + `::UR_IMAGE_INFO_DEPTH < propName`
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `NULL == pPropValue`
/// + `NULL == pPropSizeRet`
/// + `pPropValue == NULL && pPropSizeRet == NULL`
/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION
/// + If `propName` is not supported by the adapter.
/// - ::UR_RESULT_ERROR_INVALID_SIZE
/// + If `propSize` is less than the real number of bytes needed to return the info.
/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER
/// + `pPropValue == NULL && pPropSizeRet == NULL`
/// - ::UR_RESULT_ERROR_INVALID_DEVICE
/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES
/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY
ur_result_t UR_APICALL urBindlessImagesImageGetInfoExp(
ur_exp_image_mem_handle_t hImageMem, ///< [in] handle to the image memory
ur_image_info_t propName, ///< [in] queried info name
void *pPropValue, ///< [out] returned query value
size_t *pPropSizeRet ///< [out] returned query value size
void *pPropValue, ///< [out][optional] returned query value
size_t *pPropSizeRet ///< [out][optional] returned query value size
) {
ur_result_t result = UR_RESULT_SUCCESS;
return result;
Expand Down

0 comments on commit 2ee83ed

Please sign in to comment.