fix(xilinx): avoid altering function parameters

This corrects the MISRA violation C2012-17.8:
A function parameter should not be modified.
Local variable is declared and used to process the value
from the argument.

Change-Id: I96b4381c3e05f7065d824592e7b5e5929f6b3627
Signed-off-by: Nithin G <nithing@amd.com>
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
This commit is contained in:
Maheedhar Bollapalli 2024-04-22 18:21:40 +05:30
parent aa6df8ec32
commit b21e2874f8

View file

@ -217,6 +217,7 @@ static enum pm_ret_status pm_ipi_buff_read(const struct pm_proc *proc,
enum pm_ret_status pm_ipi_buff_read_callb(uint32_t *value, size_t count)
{
size_t i;
size_t local_count = count;
#if IPI_CRC_CHECK
uint32_t crc;
#endif
@ -225,8 +226,8 @@ enum pm_ret_status pm_ipi_buff_read_callb(uint32_t *value, size_t count)
IPI_BUFFER_REQ_OFFSET;
enum pm_ret_status ret = PM_RET_SUCCESS;
if (count > IPI_BUFFER_MAX_WORDS) {
count = IPI_BUFFER_MAX_WORDS;
if (local_count > IPI_BUFFER_MAX_WORDS) {
local_count = IPI_BUFFER_MAX_WORDS;
}
for (i = 0; i < count; i++) {
@ -240,7 +241,7 @@ enum pm_ret_status pm_ipi_buff_read_callb(uint32_t *value, size_t count)
/* Payload data is invalid as CRC validation failed
* Clear the payload to avoid leakage of data to upper layers
*/
memset(value, 0, count);
memset(value, 0, local_count);
}
#endif
return ret;