summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/media/allegro-dvt/allegro-core.c1
-rw-r--r--drivers/staging/media/allegro-dvt/allegro-mail.c2
-rw-r--r--drivers/staging/media/allegro-dvt/allegro-mail.h1
3 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/media/allegro-dvt/allegro-core.c b/drivers/staging/media/allegro-dvt/allegro-core.c
index 6334b351ee3b..6745a5fa1167 100644
--- a/drivers/staging/media/allegro-dvt/allegro-core.c
+++ b/drivers/staging/media/allegro-dvt/allegro-core.c
@@ -1115,6 +1115,7 @@ static int allegro_mcu_push_buffer_internal(struct allegro_channel *channel,
msg->header.length = size - sizeof(msg->header);
msg->header.type = type;
msg->channel_id = channel->mcu_channel_id;
+ msg->num_buffers = num_buffers;
buffer = msg->buffer;
list_for_each_entry(al_buffer, list, head) {
diff --git a/drivers/staging/media/allegro-dvt/allegro-mail.c b/drivers/staging/media/allegro-dvt/allegro-mail.c
index c78367d36e2e..ba1c3bc587c6 100644
--- a/drivers/staging/media/allegro-dvt/allegro-mail.c
+++ b/drivers/staging/media/allegro-dvt/allegro-mail.c
@@ -156,7 +156,7 @@ allegro_enc_push_buffers(u32 *dst, struct mcu_msg_push_buffers_internal *msg)
{
unsigned int i = 0;
struct mcu_msg_push_buffers_internal_buffer *buffer;
- unsigned int num_buffers = (msg->header.length - 4) / sizeof(*buffer);
+ unsigned int num_buffers = msg->num_buffers;
unsigned int j;
dst[i++] = msg->channel_id;
diff --git a/drivers/staging/media/allegro-dvt/allegro-mail.h b/drivers/staging/media/allegro-dvt/allegro-mail.h
index 457caf50ebe6..14b54eb52488 100644
--- a/drivers/staging/media/allegro-dvt/allegro-mail.h
+++ b/drivers/staging/media/allegro-dvt/allegro-mail.h
@@ -169,6 +169,7 @@ struct mcu_msg_push_buffers_internal_buffer {
struct mcu_msg_push_buffers_internal {
struct mcu_msg_header header;
u32 channel_id;
+ size_t num_buffers;
struct mcu_msg_push_buffers_internal_buffer buffer[];
} __attribute__ ((__packed__));