mirror of https://github.com/thesofproject/sof.git
probe: refactor function to decrease indent
following commit fixes a bug but to do the fix we need to allow ourselves more room to add ifs, so lets pull out this function Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This commit is contained in:
parent
8cec7d3ef1
commit
ead5afa6c2
|
@ -176,6 +176,18 @@ int validate_data_packet(struct probe_data_packet *data_packet)
|
|||
}
|
||||
}
|
||||
|
||||
int process_sync(struct probe_data_packet *packet, uint32_t **w_ptr, uint32_t *total_data_to_copy)
|
||||
{
|
||||
/* request to copy data_size from probe packet */
|
||||
*total_data_to_copy = packet->data_size_bytes /
|
||||
sizeof(uint32_t);
|
||||
if (packet->data_size_bytes > PACKET_MAX_SIZE)
|
||||
packet = realloc(packet,
|
||||
sizeof(struct probe_data_packet) + packet->data_size_bytes);
|
||||
*w_ptr = (uint32_t *)&packet->data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void parse_data(char *file_in)
|
||||
{
|
||||
FILE *fd_in;
|
||||
|
@ -250,14 +262,7 @@ void parse_data(char *file_in)
|
|||
break;
|
||||
case SYNC:
|
||||
/* SYNC -> CHECK */
|
||||
/* request to copy data_size from probe packet */
|
||||
total_data_to_copy = packet->data_size_bytes /
|
||||
sizeof(uint32_t);
|
||||
if (packet->data_size_bytes > PACKET_MAX_SIZE)
|
||||
packet = realloc(packet,
|
||||
sizeof(struct probe_data_packet) +
|
||||
packet->data_size_bytes);
|
||||
w_ptr = (uint32_t *)&packet->data;
|
||||
process_sync(packet, &w_ptr, &total_data_to_copy);
|
||||
state = CHECK;
|
||||
break;
|
||||
case CHECK:
|
||||
|
|
Loading…
Reference in New Issue