Use more specific ipmi error codes
Most errors in the handler were returning an unsupported code and not a
more specific code articulating the failure. Update the code to use
more specific errors.
Change-Id: I7f517d094245e8e1a6169f43582522889bb895d0
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/psu.cpp b/psu.cpp
index 1e46adc..7f334ef 100644
--- a/psu.cpp
+++ b/psu.cpp
@@ -53,7 +53,7 @@
{
std::fprintf(stderr, "Invalid command length: %u\n",
static_cast<uint32_t>(*dataLen));
- return IPMI_CC_INVALID;
+ return IPMI_CC_REQ_DATA_LEN_INVALID;
}
std::memcpy(&request, &reqBuf[0], sizeof(struct PsuResetRequest));
@@ -63,7 +63,7 @@
if (!ofs.good())
{
std::fprintf(stderr, "Unable to open file for output.\n");
- return IPMI_CC_INVALID;
+ return IPMI_CC_UNSPECIFIED_ERROR;
}
ofs << "PSU_HARDRESET_DELAY=" << request.delay << std::endl;
@@ -71,7 +71,7 @@
{
std::fprintf(stderr, "Write failed\n");
ofs.close();
- return IPMI_CC_INVALID;
+ return IPMI_CC_UNSPECIFIED_ERROR;
}
// Write succeeded, please continue.
@@ -92,7 +92,7 @@
catch (const sdbusplus::exception::SdBusError& ex)
{
log<level::ERR>("Failed to call PSU hard reset");
- return IPMI_CC_INVALID;
+ return IPMI_CC_UNSPECIFIED_ERROR;
}
replyBuf[0] = SysPsuHardReset;