Re: [PATCH 1/1] ipu3-cio2: Check receved the size against payload size, not buffer size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sakari,

Thank you for the patch.

s/receved the/the received/ in the subject line

On Tue, Oct 13, 2020 at 03:41:43PM +0300, Sakari Ailus wrote:
> 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 <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> ---
>  drivers/media/pci/intel/ipu3/ipu3-cio2.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index 51c4dd6a8f9a..dffcc74acb7e 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -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.

> +					 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.

Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

Tests are ongoing.

>  			vb2_buffer_done(&b->vbb.vb2_buf, VB2_BUF_STATE_DONE);
>  		}
>  		atomic_inc(&q->frame_sequence);

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux