diff options
author | Chicago Duan <duanzhijia01@inspur.com> | 2021-04-15 11:59:25 +0300 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2021-04-21 06:37:18 +0300 |
commit | 601af5ed832deae3f525064d94bb5a65b04554ae (patch) | |
tree | 7a58a7841cad87ca5d02ebed98f075683a95a668 | |
parent | d51e072fa60348422d6a145d76d7506de2bca4d6 (diff) | |
download | bmcweb-601af5ed832deae3f525064d94bb5a65b04554ae.tar.xz |
Redfish : Return after InternalError instead of Continue
"After setting response to internal error you should stop adding more content to response. Try to return instead of continuing a loop"
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/39970/9/redfish-core/lib/pcie_slots.hpp#169
Signed-off-by: Chicago Duan <duanzhijia01@inspur.com>
Change-Id: Iadd3062ba7fef31ba61eea1e79eb3a903716b9e9
-rw-r--r-- | redfish-core/lib/managers.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/memory.hpp | 66 | ||||
-rw-r--r-- | redfish-core/lib/storage.hpp | 4 | ||||
-rw-r--r-- | redfish-core/lib/systems.hpp | 6 |
4 files changed, 39 insertions, 39 deletions
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index c41c73eb1d..67f8d99020 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -1973,7 +1973,7 @@ class Manager : public Node // illegal property messages::internalError( asyncResp->res); - continue; + return; } asyncResp->res.jsonValue[propertyName] = *value; diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp index af619e04bb..62d8bf9ffb 100644 --- a/redfish-core/lib/memory.hpp +++ b/redfish-core/lib/memory.hpp @@ -184,7 +184,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for " "VolatileRegionSizeLimitKiB"; - continue; + return; } aResp->res.jsonValue["VolatileRegionSizeLimitMiB"] = (*value) >> 10; } @@ -197,7 +197,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for PmRegioSizeLimitKiB"; - continue; + return; } aResp->res.jsonValue["PersistentRegionSizeLimitMiB"] = (*value) >> 10; @@ -211,7 +211,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for VolatileSizeInKiB"; - continue; + return; } aResp->res.jsonValue["VolatileSizeMiB"] = (*value) >> 10; } @@ -222,7 +222,7 @@ inline void getPersistentMemoryProperties( { messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for PmSizeInKiB"; - continue; + return; } aResp->res.jsonValue["NonVolatileSizeMiB"] = (*value) >> 10; } @@ -233,7 +233,7 @@ inline void getPersistentMemoryProperties( { messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for CacheSizeInKB"; - continue; + return; } aResp->res.jsonValue["CacheSizeMiB"] = (*value >> 10); } @@ -247,7 +247,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for " "VolatileRegionMaxSizeInKib"; - continue; + return; } aResp->res.jsonValue["VolatileRegionSizeMaxMiB"] = (*value) >> 10; } @@ -260,7 +260,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for PmRegionMaxSizeInKiB"; - continue; + return; } aResp->res.jsonValue["PersistentRegionSizeMaxMiB"] = (*value) >> 10; } @@ -273,7 +273,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for " "AllocationIncrementInKiB"; - continue; + return; } aResp->res.jsonValue["AllocationIncrementMiB"] = (*value) >> 10; } @@ -286,7 +286,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for " "AllocationAlignmentInKiB"; - continue; + return; } aResp->res.jsonValue["AllocationAlignmentMiB"] = (*value) >> 10; } @@ -296,7 +296,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["VolatileRegionNumberLimit"] = *value; } @@ -306,7 +306,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["PersistentRegionNumberLimit"] = *value; } @@ -316,7 +316,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["SpareDeviceCount"] = *value; } @@ -326,7 +326,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["IsSpareDeviceEnabled"] = *value; } @@ -336,7 +336,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["IsRankSpareEnabled"] = *value; } @@ -349,7 +349,7 @@ inline void getPersistentMemoryProperties( messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for " "MaxAveragePowerLimitmW"; - continue; + return; } aResp->res.jsonValue["MaxTDPMilliWatts"] = *value; } @@ -359,7 +359,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["ConfigurationLocked"] = *value; } @@ -371,7 +371,7 @@ inline void getPersistentMemoryProperties( { messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for FormFactor"; - continue; + return; } constexpr const std::array<const char*, 3> values{"Volatile", "PMEM", "Block"}; @@ -393,7 +393,7 @@ inline void getPersistentMemoryProperties( { messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for MemoryMedia"; - continue; + return; } constexpr const std::array<const char*, 3> values{"DRAM", "NAND", "Intel3DXPoint"}; @@ -416,7 +416,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["SecurityCapabilities"][property.first] = *value; @@ -428,7 +428,7 @@ inline void getPersistentMemoryProperties( if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["SecurityCapabilities"][property.first] = *value; @@ -527,7 +527,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for RevisionCode"; - continue; + return; } aResp->res.jsonValue["FirmwareRevision"] = std::to_string(*value); @@ -550,7 +550,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, { messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for ECC"; - continue; + return; } constexpr const std::array<const char*, 4> values{ "NoECC", "SingleBitECC", "MultiBitECC", @@ -574,7 +574,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for FormFactor"; - continue; + return; } constexpr const std::array<const char*, 11> values{ "RDIMM", "UDIMM", "SO_DIMM", @@ -617,7 +617,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for MemoryAttributes"; - continue; + return; } aResp->res.jsonValue["RankCount"] = static_cast<uint64_t>(*value); @@ -667,7 +667,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["MemoryLocation"][property.first] = *value; @@ -679,7 +679,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["SparePartNumber"] = *value; } @@ -690,7 +690,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res.jsonValue["Model"] = *value; } @@ -701,7 +701,7 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } aResp->res .jsonValue["Location"]["PartLocation"]["ServiceLabel"] = @@ -745,7 +745,7 @@ inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } partition[key] = *value; } @@ -755,7 +755,7 @@ inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } partition["OffsetMiB"] = (*value >> 10); @@ -766,7 +766,7 @@ inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } partition["RegionId"] = *value; } @@ -777,7 +777,7 @@ inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp, if (value == nullptr) { messages::internalError(aResp->res); - continue; + return; } partition["PassphraseEnabled"] = *value; } @@ -789,7 +789,7 @@ inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp, messages::internalError(aResp->res); BMCWEB_LOG_DEBUG << "Invalid property type for SizeInKiB"; - continue; + return; } partition["SizeMiB"] = (*value >> 10); } diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp index c2651d5e6b..34ef39a2f8 100644 --- a/redfish-core/lib/storage.hpp +++ b/redfish-core/lib/storage.hpp @@ -239,7 +239,7 @@ class Storage : public Node { // illegal property messages::internalError(asyncResp->res); - continue; + return; } object[propertyName] = *value; } @@ -385,7 +385,7 @@ class Drive : public Node { // illegal property messages::internalError(asyncResp->res); - continue; + return; } asyncResp->res.jsonValue[propertyName] = *value; } diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index f97dba29b6..8d76722e45 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -1760,7 +1760,7 @@ inline void if (!state) { messages::internalError(aResp->res); - continue; + return; } hostWatchdogTimer["FunctionEnabled"] = *state; @@ -1772,14 +1772,14 @@ inline void if (!s) { messages::internalError(aResp->res); - continue; + return; } std::string action = dbusToRfWatchdogAction(*s); if (action.empty()) { messages::internalError(aResp->res); - continue; + return; } hostWatchdogTimer["TimeoutAction"] = action; } |