Commit 98f9aafa authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: ipu3-cio2: Check receved the size against payload size, not buffer size

Compare the received size of the payload size, not the allocated size of
the buffer that is page aligned. This way also images that aren't aligned
to page size are not warned about.

Also wrap a line over 80 characters.
Suggested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: default avatarJean-Michel Hautbois <jeanmichel.hautbois@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 3abafaf4
...@@ -561,7 +561,9 @@ static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan) ...@@ -561,7 +561,9 @@ static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan)
b = q->bufs[q->bufs_first]; b = q->bufs[q->bufs_first];
if (b) { if (b) {
unsigned int bytes = entry[1].second_entry.num_of_bytes; unsigned int received = entry[1].second_entry.num_of_bytes;
unsigned long payload =
vb2_get_plane_payload(&b->vbb.vb2_buf, 0);
q->bufs[q->bufs_first] = NULL; q->bufs[q->bufs_first] = NULL;
atomic_dec(&q->bufs_queued); atomic_dec(&q->bufs_queued);
...@@ -571,10 +573,10 @@ static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan) ...@@ -571,10 +573,10 @@ static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan)
b->vbb.vb2_buf.timestamp = ns; b->vbb.vb2_buf.timestamp = ns;
b->vbb.field = V4L2_FIELD_NONE; b->vbb.field = V4L2_FIELD_NONE;
b->vbb.sequence = atomic_read(&q->frame_sequence); b->vbb.sequence = atomic_read(&q->frame_sequence);
if (b->vbb.vb2_buf.planes[0].length != bytes) if (payload != received)
dev_warn(dev, "buffer length is %d received %d\n", dev_warn(dev,
b->vbb.vb2_buf.planes[0].length, "payload length is %lu, received %u\n",
bytes); payload, received);
vb2_buffer_done(&b->vbb.vb2_buf, VB2_BUF_STATE_DONE); vb2_buffer_done(&b->vbb.vb2_buf, VB2_BUF_STATE_DONE);
} }
atomic_inc(&q->frame_sequence); atomic_inc(&q->frame_sequence);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment