Skip to content

Commit

Permalink
tests: canbus: isotp: conformance: fix global variable usage
Browse files Browse the repository at this point in the history
Even though it was leading to the same result, the function should use
its parameter and not the global variable for desired frames.

Signed-off-by: Martin Jäger <martin@libre.solar>
  • Loading branch information
martinjaeger committed Sep 7, 2023
1 parent 07787e5 commit b8b7625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/subsys/canbus/isotp/conformance/src/main.c
Expand Up @@ -372,15 +372,15 @@ static void prepare_cf_frames(struct frame_desired *frames, size_t frames_cnt,
for (i = 0; i < frames_cnt && remaining_length; i++) {
frames[i].data[0] = CF_PCI_BYTE_1 | ((i+1) & 0x0F);
frames[i].length = TX_DL;
memcpy(&des_frames[i].data[1], data_ptr, DATA_SIZE_CF);
memcpy(&frames[i].data[1], data_ptr, DATA_SIZE_CF);

if (remaining_length < DATA_SIZE_CF) {
if ((IS_ENABLED(CONFIG_ISOTP_ENABLE_TX_PADDING) && tx) ||
(IS_ENABLED(CONFIG_ISOTP_REQUIRE_RX_PADDING) && !tx)) {
uint8_t padded_dlc = can_bytes_to_dlc(MAX(8, remaining_length + 1));
uint8_t padded_len = can_dlc_to_bytes(padded_dlc);

memset(&des_frames[i].data[remaining_length + 1], 0xCC,
memset(&frames[i].data[remaining_length + 1], 0xCC,
padded_len - remaining_length - 1);
frames[i].length = padded_len;
} else {
Expand Down

0 comments on commit b8b7625

Please sign in to comment.