diff mbox series

[2/2] media: vim2m: ensure that width is multiple of two

Message ID 0a47c5ad8099c5988e961d44221b4a95d74f8322.1551202610.git.mchehab+samsung@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] media: vim2m: improve debug messages | expand

Commit Message

Mauro Carvalho Chehab Feb. 26, 2019, 5:36 p.m. UTC
The copy logic assumes that the data width is multiple of two,
as this is needed in order to support YUYV.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/platform/vim2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mauro Carvalho Chehab Feb. 26, 2019, 6:04 p.m. UTC | #1
Em Tue, 26 Feb 2019 14:36:55 -0300
Mauro Carvalho Chehab <mchehab+samsung@kernel.org> escreveu:

> The copy logic assumes that the data width is multiple of two,
> as this is needed in order to support YUYV.

Please ignore this one. The driver already aligns (it enforces
an 8 pixels alignment... 2 pixels should be enough).

> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
> ---
>  drivers/media/platform/vim2m.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
> index ab288e8377f1..89384f324e25 100644
> --- a/drivers/media/platform/vim2m.c
> +++ b/drivers/media/platform/vim2m.c
> @@ -801,7 +801,7 @@ static int vidioc_s_fmt(struct vim2m_ctx *ctx, struct v4l2_format *f)
>  	}
>  
>  	q_data->fmt		= find_format(f);
> -	q_data->width		= f->fmt.pix.width;
> +	q_data->width		= f->fmt.pix.width & (~1);
>  	q_data->height		= f->fmt.pix.height;
>  	q_data->sizeimage	= q_data->width * q_data->height
>  				* q_data->fmt->depth >> 3;



Thanks,
Mauro
diff mbox series

Patch

diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c
index ab288e8377f1..89384f324e25 100644
--- a/drivers/media/platform/vim2m.c
+++ b/drivers/media/platform/vim2m.c
@@ -801,7 +801,7 @@  static int vidioc_s_fmt(struct vim2m_ctx *ctx, struct v4l2_format *f)
 	}
 
 	q_data->fmt		= find_format(f);
-	q_data->width		= f->fmt.pix.width;
+	q_data->width		= f->fmt.pix.width & (~1);
 	q_data->height		= f->fmt.pix.height;
 	q_data->sizeimage	= q_data->width * q_data->height
 				* q_data->fmt->depth >> 3;