summaryrefslogtreecommitdiff
path: root/redfish-core/include/utils
diff options
context:
space:
mode:
authorLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-06-27 10:36:53 +0300
committerLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-06-30 23:01:05 +0300
commitcf3b484e14fe9754c1812d9871d77b5b1ac9f620 (patch)
treeca10a8862e24439ef3cb65374dce29f12b37a684 /redfish-core/include/utils
parentc05bba459941ae17aa9508529ccd0284e5300213 (diff)
downloadbmcweb-cf3b484e14fe9754c1812d9871d77b5b1ac9f620.tar.xz
Refactor redfishPcieGenerationFromDbus and redfishSlotType
This commit refactors the redfishPcieGenerationFromDbus and redfishSlotType functions by changing their return types. The return value std::nullopt indicates that there is no output, while the return value pcie_device::PCIeTypes::Invalid indicates that the input was invalid and returns an internal error. Additionally, the code that calls these functions has been updated to accommodate the changes. Tested: Validator passed Change-Id: I3f7c1a3c8c6b53fd9a39928e3ad9a5fed9be97ff Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Diffstat (limited to 'redfish-core/include/utils')
-rw-r--r--redfish-core/include/utils/pcie_util.hpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/redfish-core/include/utils/pcie_util.hpp b/redfish-core/include/utils/pcie_util.hpp
index d9e8480cc9..4db6e03249 100644
--- a/redfish-core/include/utils/pcie_util.hpp
+++ b/redfish-core/include/utils/pcie_util.hpp
@@ -123,11 +123,10 @@ inline std::optional<pcie_slots::SlotTypes>
if (slotType ==
"xyz.openbmc_project.Inventory.Item.PCIeSlot.SlotTypes.Unknown")
{
- return pcie_slots::SlotTypes::Invalid;
+ return std::nullopt;
}
- // Unspecified slotType should return an internal error.
- return std::nullopt;
+ return pcie_slots::SlotTypes::Invalid;
}
inline std::optional<pcie_device::PCIeTypes>
@@ -162,11 +161,10 @@ inline std::optional<pcie_device::PCIeTypes>
generationInUse ==
"xyz.openbmc_project.Inventory.Item.PCIeSlot.Generations.Unknown")
{
- return pcie_device::PCIeTypes::Invalid;
+ return std::nullopt;
}
- // The value is not unknown or Gen1-5, need return an internal error.
- return std::nullopt;
+ return pcie_device::PCIeTypes::Invalid;
}
} // namespace pcie_util