diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch new file mode 100644 index 000000000..9cf75563e --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-intel/smbios/smbios-mdrv2/0001-Replace-throw-with-log-error-message.patch @@ -0,0 +1,130 @@ +From b84c3bd333a7b67d7b7ff73e12c382aa529f3e5c Mon Sep 17 00:00:00 2001 +From: Kuiying Wang <kuiying.wang@intel.com> +Date: Tue, 20 Oct 2020 15:44:41 +0800 +Subject: [PATCH] Replace throw with log error message. + +Replace throw with log error message and return. +When run into error, log error message but not crash +smbios service as throw did. + +Tested: +smbiosmdrv2app is working well. + +Change-Id: Ia2d40997987a0c84a613568d65f93006043459d0 +Signed-off-by: Kuiying Wang <kuiying.wang@intel.com> +--- + src/mdrv2.cpp | 37 ++++++++++++++++++++----------------- + 1 file changed, 20 insertions(+), 17 deletions(-) + +diff --git a/src/mdrv2.cpp b/src/mdrv2.cpp +index 9a73c65..c1bc09d 100644 +--- a/src/mdrv2.cpp ++++ b/src/mdrv2.cpp +@@ -35,8 +35,9 @@ std::vector<uint8_t> MDR_V2::getDirectoryInformation(uint8_t dirIndex) + if (dirIndex > smbiosDir.dirEntries) + { + responseDir.push_back(0); +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- InvalidParameter(); ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "getDirectoryInformation: Invalid Parameter"); ++ return responseDir; + } + responseDir.push_back(mdr2Version); + responseDir.push_back(smbiosDir.dirVersion); +@@ -117,8 +118,6 @@ std::vector<uint8_t> MDR_V2::getDataOffer() + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "smbios is not ready for update"); +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- UpdateInProgress(); + } + return offer; + } +@@ -173,8 +172,9 @@ std::vector<uint8_t> MDR_V2::getDataInformation(uint8_t idIndex) + + if (idIndex >= maxDirEntries) + { +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- InvalidParameter(); ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "getDataInformation: Invalid Parameter"); ++ return responseInfo; + } + + for (uint8_t index = 0; index < sizeof(DataIdStruct); index++) +@@ -253,15 +253,13 @@ bool MDR_V2::sendDirectoryInformation(uint8_t dirVersion, uint8_t dirIndex, + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Send Dir info failed - input parameter invalid"); +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- InvalidParameter(); ++ return teminate; + } + if (dirEntry.size() < sizeof(Mdr2DirEntry)) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Directory size invalid"); +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- InvalidParameter(); ++ return teminate; + } + if (dirVersion == smbiosDir.dirVersion) + { +@@ -307,8 +305,9 @@ bool MDR_V2::sendDataInformation(uint8_t idIndex, uint8_t flag, + { + if (idIndex >= maxDirEntries) + { +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- InvalidParameter(); ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "sendDataInformation: Invalid Parameter"); ++ return false; + } + int entryChanged = 0; + if (smbiosDir.dir[idIndex].common.dataSetSize != dataLen) +@@ -341,8 +340,7 @@ int MDR_V2::findIdIndex(std::vector<uint8_t> dataInfo) + { + phosphor::logging::log<phosphor::logging::level::ERR>( + "Length of dataInfo invalid"); +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error:: +- InvalidParameter(); ++ return -1; + } + std::array<uint8_t, 16> arrayDataInfo; + +@@ -364,7 +362,9 @@ int MDR_V2::findIdIndex(std::vector<uint8_t> dataInfo) + return index; + } + } +- throw sdbusplus::xyz::openbmc_project::Smbios::MDR_V2::Error::InvalidId(); ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "findIdIndex: Invalid ID"); ++ return -1; + } + + uint8_t MDR_V2::directoryEntries(uint8_t value) +@@ -546,7 +546,9 @@ std::vector<boost::container::flat_map<std::string, RecordVariant>> + + if (dataIn == nullptr) + { +- throw std::runtime_error("Data not populated"); ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Data not populated"); ++ return ret; + } + + do +@@ -617,7 +619,8 @@ std::vector<boost::container::flat_map<std::string, RecordVariant>> + return ret; + } + +- throw std::invalid_argument("Invalid record type"); ++ phosphor::logging::log<phosphor::logging::level::ERR>( ++ "Invalid record type"); + return ret; + } + +-- +2.7.4 + |