ipu3-cio2: Check receved the size against payload size, not buffer size
Subsystems (2)
Sakari Ailus
maintainerPATCH 1/1 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.
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +5 -4
@@ -571,10 +571,11 @@ static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan) b->vbb.vb2_buf.timestamp = ns; b->vbb.field =V4L2_FIELD_NONE ; b->vbb.sequence =atomic_read (&q->frame_sequence); -if (b->vbb.vb2_buf.planes[0 ].length != bytes) -dev_warn (dev,"buffer length is %d received %d\n" , - b->vbb.vb2_buf.planes[0 ].length, - bytes); +if (vb2_get_plane_payload (&b->vbb.vb2_buf,0 ) != bytes) +dev_warn (dev, +"payload length is %lu received %u\n" , +vb2_get_plane_payload (&b->vbb.vb2_buf, +0 ), bytes);vb2_buffer_done (&b->vbb.vb2_buf,VB2_BUF_STATE_DONE ); }atomic_inc (&q->frame_sequence);
Signature · 1 line
2.27.0
Hi Sakari,
Thank you for the patch.
s/receved the/the received/ in the subject line
Quoted 17 lines · Sakari Ailus
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 Laurent Pinchart <[email protected]>Signed-off-by Sakari Ailus <[email protected]>--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/media/pci/intel/ipu3/ipu3-cio2.c +0
-0
drivers/media/pci/intel/ipu3/ipu3-cio2.c static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan) · line 576
Quoted 10 lines
drivers/media/pci/intel/ipu3/ipu3-cio2.c +3
-4@@ -571,10 +571,11 @@ static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan) b->vbb.vb2_buf.timestamp = ns; b->vbb.field =V4L2_FIELD_NONE ; b->vbb.sequence =atomic_read (&q->frame_sequence); -if (b->vbb.vb2_buf.planes[0 ].length != bytes) -dev_warn (dev,"buffer length is %d received %d\n" , - b->vbb.vb2_buf.planes[0 ].length, - bytes); +if (vb2_get_plane_payload (&b->vbb.vb2_buf,0 ) != bytes) + dev_warn(dev, + "payload length is %lu received %u\n",
Maybe ""payload length %lu != received %u\n" ? Or at least a comma after %lu.
drivers/media/pci/intel/ipu3/ipu3-cio2.c static void cio2_buffer_done(struct cio2_device *cio2, unsigned int dma_chan) · line 578
Quoted 2 lines
drivers/media/pci/intel/ipu3/ipu3-cio2.c +2
-0+vb2_get_plane_payload (&b->vbb.vb2_buf, + 0), bytes);
I would store vb2_get_plane_payload(&b->vbb.vb2_buf, 0) in a local variable to make this look a bit nicer.
Tests are ongoing.
Quoted 3 lines
drivers/media/pci/intel/ipu3/ipu3-cio2.c +0
-0vb2_buffer_done (&b->vbb.vb2_buf,VB2_BUF_STATE_DONE ); }atomic_inc (&q->frame_sequence);
Signature · 3 lines
Regards, Laurent Pinchart
Hi Sakari,
Thanks for the patch !
Quoted 8 lines · Sakari Ailus
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 Laurent Pinchart <[email protected]>Signed-off-by Sakari Ailus <[email protected]>
Sakari Ailus
maintainerQuoted 9 lines · Jean-Michel Hautbois
Hi Sakari,
Thanks for the patch !
Quoted 4 lines · Sakari Ailus
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.
Quoted 6 lines
Quoted 4 lines
Also wrap a line over 80 characters.
Suggested-by Laurent Pinchart <[email protected]>Signed-off-by Sakari Ailus <[email protected]>Tested-by Jean-Michel Hautbois <[email protected]>
Merci, Jean-Michel!
Signature · 1 line
Sakari Ailus