Fix issues reported by static analysis tool

Following are the issues reported by the clang static
analysis tool in the CI, this commit is an attempt to
fix those.
1. warning: Value stored to 'rc' during its initialization
   is never read [deadcode.DeadStores]
   auto rc = getHostState();
2. warning: Branch condition evaluates to a garbage
   value [core.uninitialized.Branch]
   if (!pdr)
3. warning: Value stored to 'type' during its initialization
   is never read [deadcode.DeadStores]
   uint8_t type = requestMsg[1];
4. warning: Value stored to 'sum' during its initialization
   is never read [deadcode.DeadStores]
   auto sum = crc32(fruData.data(), recordTableSize + pads);
5. warning: Value stored to 'responsePtr' during its initialization
   is never read [deadcode.DeadStores]
   auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());

Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I0673403a36c90025afd0f2b1bca1d7f3ea052033
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index 3ec5d92..f0c2214 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -257,6 +257,8 @@
                                   uint16_t recordSetIdentifer,
                                   uint8_t recordType, uint8_t fieldType)
 {
+    using sum = uint32_t;
+
     // FRU table is built lazily, build if not done.
     buildFRUTable();
 
@@ -278,7 +280,7 @@
     }
 
     auto pads = utils::getNumPadBytes(recordTableSize);
-    auto sum = crc32(fruData.data(), recordTableSize + pads);
+    crc32(fruData.data(), recordTableSize + pads);
 
     auto iter = fruData.begin() + recordTableSize + pads;
     std::copy_n(reinterpret_cast<const uint8_t*>(&checksum), sizeof(checksum),
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 9cdc6fd..0ad5fb6 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -185,7 +185,6 @@
     }
 
     Response response(sizeof(pldm_msg_hdr) + PLDM_GET_PDR_MIN_RESP_BYTES, 0);
-    auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
 
     if (payloadLength != PLDM_GET_PDR_REQ_BYTES)
     {
@@ -230,7 +229,7 @@
         response.resize(sizeof(pldm_msg_hdr) + PLDM_GET_PDR_MIN_RESP_BYTES +
                             respSizeBytes,
                         0);
-        responsePtr = reinterpret_cast<pldm_msg*>(response.data());
+        auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
         rc = encode_get_pdr_resp(
             request->hdr.instance_id, PLDM_SUCCESS, e.handle.nextRecordHandle,
             0, PLDM_START_AND_END, respSizeBytes, recordData, 0, responsePtr);
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index d1889ee..53dbe0b 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -65,8 +65,8 @@
     processRxMsg(const std::vector<uint8_t>& requestMsg, Invoker& invoker,
                  requester::Handler<requester::Request>& handler)
 {
+    using type = uint8_t;
     uint8_t eid = requestMsg[0];
-    uint8_t type = requestMsg[1];
     pldm_header_info hdrFields{};
     auto hdr = reinterpret_cast<const pldm_msg_hdr*>(
         requestMsg.data() + sizeof(eid) + sizeof(type));
diff --git a/softoff/softoff.cpp b/softoff/softoff.cpp
index 9819931..ffc81c8 100644
--- a/softoff/softoff.cpp
+++ b/softoff/softoff.cpp
@@ -33,13 +33,13 @@
 SoftPowerOff::SoftPowerOff(sdbusplus::bus::bus& bus, sd_event* event) :
     bus(bus), timer(event)
 {
-    auto rc = getHostState();
+    getHostState();
     if (hasError || completed)
     {
         return;
     }
 
-    rc = getEffecterID();
+    auto rc = getEffecterID();
     if (completed)
     {
         std::cerr
@@ -254,12 +254,11 @@
         for (auto& rep : Response)
         {
             pdr = reinterpret_cast<pldm_state_sensor_pdr*>(rep.data());
-        }
-
-        if (!pdr)
-        {
-            std::cerr << "Failed to get state sensor PDR.\n";
-            return PLDM_ERROR;
+            if (!pdr)
+            {
+                std::cerr << "Failed to get state sensor PDR.\n";
+                return PLDM_ERROR;
+            }
         }
 
         sensorID = pdr->sensor_id;