Fix the return value of pack_pldm_header and unpack_pldm_header

- The intent behind this commit is to fix the return value of the
  pack_pldm_header and the unpack_pldm_header methods.

- According to PLDM spec, their return value should be `uint8_t`, not
  `int`, so 0 is PLDM_SUCCESS and non-0 is failure.

- Also, when we call the pack_pldm_header and unpack_pldm_header
  methods, we need to verify the return value of the method.

Tested: Built pldm successfully and Unit Test passes.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I0bd6838c4fb3b90f821c10324e4536ed352ffcfa
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp
index 5c25587..9684f0b 100644
--- a/pldmd/pldmd.cpp
+++ b/pldmd/pldmd.cpp
@@ -70,8 +70,10 @@
     if (PLDM_SUCCESS != unpack_pldm_header(hdr, &hdrFields))
     {
         std::cerr << "Empty PLDM request header \n";
+        return response;
     }
-    else if (PLDM_RESPONSE != hdrFields.msg_type)
+
+    if (PLDM_RESPONSE != hdrFields.msg_type)
     {
         auto request = reinterpret_cast<const pldm_msg*>(hdr);
         size_t requestLen = requestMsg.size() - sizeof(struct pldm_msg_hdr) -
@@ -91,8 +93,7 @@
             header.instance = hdrFields.instance;
             header.pldm_type = hdrFields.pldm_type;
             header.command = hdrFields.command;
-            auto result = pack_pldm_header(&header, responseHdr);
-            if (PLDM_SUCCESS != result)
+            if (PLDM_SUCCESS != pack_pldm_header(&header, responseHdr))
             {
                 std::cerr << "Failed adding response header \n";
             }