mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 06:20:00 +02:00
canfdtest: convert towards kernel coding style
This commit is contained in:
+8
-13
@@ -110,13 +110,8 @@ static void print_frame(canid_t id, const uint8_t *data, int dlc, int inc_data)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_compare(
|
static void print_compare(canid_t exp_id, const uint8_t *exp_data, uint8_t exp_dlc,
|
||||||
canid_t exp_id,
|
canid_t rec_id, const uint8_t *rec_data, uint8_t rec_dlc,
|
||||||
const uint8_t *exp_data,
|
|
||||||
uint8_t exp_dlc,
|
|
||||||
canid_t rec_id,
|
|
||||||
const uint8_t *rec_data,
|
|
||||||
uint8_t rec_dlc,
|
|
||||||
int inc)
|
int inc)
|
||||||
{
|
{
|
||||||
printf("expected: ");
|
printf("expected: ");
|
||||||
@@ -255,7 +250,7 @@ static int check_frame(const struct canfd_frame *frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 1; i < frame->len; i++) {
|
for (i = 1; i < frame->len; i++) {
|
||||||
if (frame->data[i] != (uint8_t)(frame->data[i-1] + 1)) {
|
if (frame->data[i] != (uint8_t)(frame->data[i - 1] + 1)) {
|
||||||
printf("Frame inconsistent!\n");
|
printf("Frame inconsistent!\n");
|
||||||
print_frame(frame->can_id, frame->data, frame->len, 0);
|
print_frame(frame->can_id, frame->data, frame->len, 0);
|
||||||
err = -1;
|
err = -1;
|
||||||
@@ -263,7 +258,7 @@ static int check_frame(const struct canfd_frame *frame)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,11 +319,11 @@ static int can_echo_gen(void)
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tx_frames = calloc(inflight_count, sizeof(* tx_frames));
|
tx_frames = calloc(inflight_count, sizeof(*tx_frames));
|
||||||
if (!tx_frames)
|
if (!tx_frames)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
recv_tx = calloc(inflight_count, sizeof(* recv_tx));
|
recv_tx = calloc(inflight_count, sizeof(*recv_tx));
|
||||||
if (!recv_tx) {
|
if (!recv_tx) {
|
||||||
err = -1;
|
err = -1;
|
||||||
goto out_free_tx_frames;
|
goto out_free_tx_frames;
|
||||||
@@ -400,9 +395,9 @@ static int can_echo_gen(void)
|
|||||||
|
|
||||||
printf("\nTest messages sent and received: %d\n", loops);
|
printf("\nTest messages sent and received: %d\n", loops);
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
free(recv_tx);
|
free(recv_tx);
|
||||||
out_free_tx_frames:
|
out_free_tx_frames:
|
||||||
free(tx_frames);
|
free(tx_frames);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
Reference in New Issue
Block a user