diff --git a/opae-libs/CMakeLists.txt b/opae-libs/CMakeLists.txt index cb5be18600bf..240ba290b695 100644 --- a/opae-libs/CMakeLists.txt +++ b/opae-libs/CMakeLists.txt @@ -27,8 +27,8 @@ cmake_minimum_required(VERSION 2.8.12) project(opae-libs) -set(OPAE_VERSION_MAJOR 1 CACHE STRING "OPAE major version" FORCE) -set(OPAE_VERSION_MINOR 4 CACHE STRING "OPAE minor version" FORCE) +set(OPAE_VERSION_MAJOR 2 CACHE STRING "OPAE major version" FORCE) +set(OPAE_VERSION_MINOR 0 CACHE STRING "OPAE minor version" FORCE) set(OPAE_VERSION_REVISION 0 CACHE STRING "OPAE revision version" FORCE) set(OPAE_VERSION ${OPAE_VERSION_MAJOR}.${OPAE_VERSION_MINOR}.${OPAE_VERSION_REVISION} CACHE STRING "OPAE version" FORCE) @@ -102,12 +102,12 @@ option(OPAE_PRESERVE_REPOS "Disable refresh of external repos" OFF) mark_as_advanced(OPAE_PRESERVE_REPOS) if(OPAE_BUILD_TESTS) - option(OPAE_TEST_TAG "Desired branch for opae-test" master) + option(OPAE_TEST_TAG "Desired branch for opae-test" release/2.0.0) mark_as_advanced(OPAE_TEST_TAG) endif(OPAE_BUILD_TESTS) if(OPAE_BUILD_SIM) - option(OPAE_SIM_TAG "Desired branch for opae-sim" master) + option(OPAE_SIM_TAG "Desired branch for opae-sim" release/2.0.0) mark_as_advanced(OPAE_SIM_TAG) endif(OPAE_BUILD_SIM) diff --git a/opae-libs/include/opae/cxx/core/pvalue.h b/opae-libs/include/opae/cxx/core/pvalue.h index 767f9ef416a7..2a0319e8e157 100644 --- a/opae-libs/include/opae/cxx/core/pvalue.h +++ b/opae-libs/include/opae/cxx/core/pvalue.h @@ -1,4 +1,4 @@ -// Copyright(c) 2018, Intel Corporation +// Copyright(c) 2018-2020, Intel Corporation // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: @@ -93,9 +93,8 @@ struct guid_t { * @param[in] str The guid string. */ void parse(const char *str) { - int u; is_set_ = false; - if (0 != (u = uuid_parse(str, data_.data()))) { + if (0 != uuid_parse(str, data_.data())) { throw except(OPAECXX_HERE); } ASSERT_FPGA_OK(fpgaPropertiesSetGUID(*props_, data_.data())); @@ -165,7 +164,7 @@ struct pvalue { typedef typename std::conditional::value, typename std::string, T>::type copy_t; - pvalue() : props_(0), is_set_(false), get_(nullptr), set_(nullptr) {} + pvalue() : props_(0), is_set_(false), get_(nullptr), set_(nullptr), copy_() {} /** * @brief pvalue contructor that takes in a reference to fpga_properties @@ -176,7 +175,7 @@ struct pvalue { * @param s The setter function */ pvalue(fpga_properties *p, getter_t g, setter_t s) - : props_(p), is_set_(false), get_(g), set_(s) {} + : props_(p), is_set_(false), get_(g), set_(s), copy_() {} /** * @brief Overload of `=` operator that calls the wrapped setter @@ -255,9 +254,9 @@ struct pvalue { private: fpga_properties *props_; bool is_set_; - copy_t copy_; getter_t get_; setter_t set_; + copy_t copy_; }; /** diff --git a/opae-libs/plugins/xfpga/metrics/afu_metrics.c b/opae-libs/plugins/xfpga/metrics/afu_metrics.c index d1024f8eb297..1dc8b038002f 100644 --- a/opae-libs/plugins/xfpga/metrics/afu_metrics.c +++ b/opae-libs/plugins/xfpga/metrics/afu_metrics.c @@ -158,10 +158,11 @@ fpga_result get_afu_metric_value(fpga_handle handle, if (metric_num == _fpga_enum_metric->metric_num) { result = xfpga_fpgaReadMMIO64(handle, 0, _fpga_enum_metric->mmio_offset, &metric_csr.csr); - - fpga_metric->value.ivalue = metric_csr.value; - result = FPGA_OK; - + if (result != FPGA_OK) { + OPAE_ERR("Failed to get metric"); + break; + } + fpga_metric->value.ivalue = metric_csr.value; } } diff --git a/opae-libs/plugins/xfpga/metrics/metrics_utils.c b/opae-libs/plugins/xfpga/metrics/metrics_utils.c index b11a7c9ede18..e6728af799aa 100644 --- a/opae-libs/plugins/xfpga/metrics/metrics_utils.c +++ b/opae-libs/plugins/xfpga/metrics/metrics_utils.c @@ -323,7 +323,10 @@ fpga_result enum_bmc_metrics_info(struct _fpga_handle *_handle, for (x = 0; x < num_sensors; x++) { result = xfpga_bmcGetSDRDetails(_handle, values, x, &details); - + if (result != FPGA_OK) { + OPAE_ERR("Failed to get sensor details."); + return result; + } if (details.sensor_type == BMC_THERMAL) { diff --git a/opae-libs/plugins/xfpga/open.c b/opae-libs/plugins/xfpga/open.c index 9bc1a5cd7eb6..85549797d612 100644 --- a/opae-libs/plugins/xfpga/open.c +++ b/opae-libs/plugins/xfpga/open.c @@ -87,9 +87,17 @@ xfpga_fpgaOpen(fpga_token token, fpga_handle *handle, int flags) // Init MMIO table _handle->mmio_root = wsid_tracker_init(4); + if (NULL == _handle->mmio_root) { + result = FPGA_NO_MEMORY; + goto out_free1; + } // Init workspace table _handle->wsid_root = wsid_tracker_init(16384); + if (NULL == _handle->wsid_root) { + result = FPGA_NO_MEMORY; + goto out_free2; + } // Init metric enum _handle->metric_enum_status = false; @@ -151,7 +159,9 @@ xfpga_fpgaOpen(fpga_token token, fpga_handle *handle, int flags) out_free: wsid_tracker_cleanup(_handle->wsid_root, NULL); +out_free2: wsid_tracker_cleanup(_handle->mmio_root, NULL); +out_free1: free(_handle); if (-1 != fddev) {