ipmi/manualcmds: cleanup return codes

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I5525518e41d9f74d022fb8a1981d3792a4e825b5
diff --git a/ipmi/manualcmds.cpp b/ipmi/manualcmds.cpp
index ddb70f9..ce6bb94 100644
--- a/ipmi/manualcmds.cpp
+++ b/ipmi/manualcmds.cpp
@@ -92,7 +92,6 @@
 static ipmi_ret_t getFailsafeModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
                                        size_t* dataLen)
 {
-    ipmi_ret_t rc = IPMI_CC_OK;
     bool current;
 
     if (*dataLen < sizeof(struct FanCtrlRequest))
@@ -103,7 +102,8 @@
     const auto request =
         reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
 
-    rc = getFanCtrlProperty(request->zone, &current, failsafeProperty);
+    ipmi_ret_t rc =
+        getFanCtrlProperty(request->zone, &current, failsafeProperty);
     if (rc)
     {
         return rc;
@@ -111,7 +111,7 @@
 
     *replyBuf = (uint8_t)current;
     *dataLen = sizeof(uint8_t);
-    return rc;
+    return IPMI_CC_OK;
 }
 
 /*
@@ -123,7 +123,6 @@
 static ipmi_ret_t getManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
                                      size_t* dataLen)
 {
-    ipmi_ret_t rc = IPMI_CC_OK;
     bool current;
 
     if (*dataLen < sizeof(struct FanCtrlRequest))
@@ -134,7 +133,7 @@
     const auto request =
         reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
 
-    rc = getFanCtrlProperty(request->zone, &current, manualProperty);
+    ipmi_ret_t rc = getFanCtrlProperty(request->zone, &current, manualProperty);
     if (rc)
     {
         return rc;
@@ -142,7 +141,7 @@
 
     *replyBuf = (uint8_t)current;
     *dataLen = sizeof(uint8_t);
-    return rc;
+    return IPMI_CC_OK;
 }
 
 /*
@@ -155,7 +154,6 @@
 static ipmi_ret_t setManualModeState(const uint8_t* reqBuf, uint8_t* replyBuf,
                                      size_t* dataLen)
 {
-    ipmi_ret_t rc = IPMI_CC_OK;
     if (*dataLen < sizeof(struct FanCtrlRequestSet))
     {
         return IPMI_CC_INVALID;
@@ -180,6 +178,8 @@
     pimMsg.append(manualProperty);
     pimMsg.append(v);
 
+    ipmi_ret_t rc = IPMI_CC_OK;
+
     try
     {
         PropertyWriteBus.call_noreply(pimMsg);
@@ -197,7 +197,6 @@
 static ipmi_ret_t manualModeControl(ipmi_cmd_t cmd, const uint8_t* reqBuf,
                                     uint8_t* replyCmdBuf, size_t* dataLen)
 {
-    ipmi_ret_t rc = IPMI_CC_OK;
     // FanCtrlRequest is the smaller of the requests, so it's at a minimum.
     if (*dataLen < sizeof(struct FanCtrlRequest))
     {
@@ -207,6 +206,8 @@
     const auto request =
         reinterpret_cast<const struct FanCtrlRequest*>(&reqBuf[0]);
 
+    ipmi_ret_t rc = IPMI_CC_OK;
+
     switch (request->command)
     {
         case GET_CONTROL_STATE: