platform: pldm_msgbuf for decode_get_numeric_effecter_value_req()
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I70fbd51d31efe72e61159b9db98163b8ef9ab143
diff --git a/src/platform.c b/src/platform.c
index f847fe1..8a7b6fe 100644
--- a/src/platform.c
+++ b/src/platform.c
@@ -1559,20 +1559,23 @@
size_t payload_length,
uint16_t *effecter_id)
{
+ struct pldm_msgbuf _buf;
+ struct pldm_msgbuf *buf = &_buf;
+ int rc;
+
if (msg == NULL || effecter_id == NULL) {
return PLDM_ERROR_INVALID_DATA;
}
- if (payload_length != PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES) {
- return PLDM_ERROR_INVALID_LENGTH;
+ rc = pldm_msgbuf_init(buf, PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES,
+ msg->payload, payload_length);
+ if (rc) {
+ return rc;
}
- struct pldm_get_numeric_effecter_value_req *request =
- (struct pldm_get_numeric_effecter_value_req *)msg->payload;
+ pldm_msgbuf_extract(buf, effecter_id);
- *effecter_id = le16toh(request->effecter_id);
-
- return PLDM_SUCCESS;
+ return pldm_msgbuf_destroy_consumed(buf);
}
int decode_get_numeric_effecter_value_resp(