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/libpldm/base.h b/libpldm/base.h
index 36b9d8f..451137d 100644
--- a/libpldm/base.h
+++ b/libpldm/base.h
@@ -223,8 +223,8 @@
* @note Caller is responsible for alloc and dealloc of msg
* and hdr params
*/
-int pack_pldm_header(const struct pldm_header_info *hdr,
- struct pldm_msg_hdr *msg);
+uint8_t pack_pldm_header(const struct pldm_header_info *hdr,
+ struct pldm_msg_hdr *msg);
/**
* @brief Unpack the PLDM header from the PLDM message.
@@ -236,8 +236,8 @@
* @note Caller is responsible for alloc and dealloc of msg
* and hdr params
*/
-int unpack_pldm_header(const struct pldm_msg_hdr *msg,
- struct pldm_header_info *hdr);
+uint8_t unpack_pldm_header(const struct pldm_msg_hdr *msg,
+ struct pldm_header_info *hdr);
/* Requester */