linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] [media] mt9v032: fix hblank calculation
@ 2014-05-26 13:55 Philipp Zabel
  2014-05-28 11:12 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2014-05-26 13:55 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Mauro Carvalho Chehab, linux-media, Philipp Zabel

Since (min_row_time - crop->width) can be negative, we have to do a signed
comparison here. Otherwise max_t casts the negative value to unsigned int
and sets min_hblank to that invalid value.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
Changes since v1:
 - Remove now unneeded casts to (int).
---
 drivers/media/i2c/mt9v032.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 40172b8..f04d0bb 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt9v032)
 
 	if (mt9v032->version->version == MT9V034_CHIP_ID_REV1)
 		min_hblank += (mt9v032->hratio - 1) * 10;
-	min_hblank = max_t(unsigned int, (int)mt9v032->model->data->min_row_time - crop->width,
-			   (int)min_hblank);
+	min_hblank = max_t(int, mt9v032->model->data->min_row_time - crop->width,
+			   min_hblank);
 	hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
 
 	return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank);
-- 
2.0.0.rc2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] [media] mt9v032: fix hblank calculation
  2014-05-26 13:55 [PATCH v2] [media] mt9v032: fix hblank calculation Philipp Zabel
@ 2014-05-28 11:12 ` Laurent Pinchart
  2014-05-28 14:37   ` Philipp Zabel
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2014-05-28 11:12 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: Mauro Carvalho Chehab, linux-media

Hi Philipp,

Thank you for the patch.

On Monday 26 May 2014 15:55:51 Philipp Zabel wrote:
> Since (min_row_time - crop->width) can be negative, we have to do a signed
> comparison here. Otherwise max_t casts the negative value to unsigned int
> and sets min_hblank to that invalid value.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree. Do you see a need to fasttrack this to v3.16 or can it 
be applied to v3.17 ? Should I CC stable ?

> ---
> Changes since v1:
>  - Remove now unneeded casts to (int).
> ---
>  drivers/media/i2c/mt9v032.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> index 40172b8..f04d0bb 100644
> --- a/drivers/media/i2c/mt9v032.c
> +++ b/drivers/media/i2c/mt9v032.c
> @@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt9v032)
> 
>  	if (mt9v032->version->version == MT9V034_CHIP_ID_REV1)
>  		min_hblank += (mt9v032->hratio - 1) * 10;
> -	min_hblank = max_t(unsigned int, (int)mt9v032->model->data->min_row_time 
-
> crop->width, -			   (int)min_hblank);
> +	min_hblank = max_t(int, mt9v032->model->data->min_row_time - crop->width,
> +			   min_hblank);
>  	hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
> 
>  	return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank);

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] [media] mt9v032: fix hblank calculation
  2014-05-28 11:12 ` Laurent Pinchart
@ 2014-05-28 14:37   ` Philipp Zabel
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2014-05-28 14:37 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Mauro Carvalho Chehab, linux-media

Hi Laurent,

Am Mittwoch, den 28.05.2014, 13:12 +0200 schrieb Laurent Pinchart:
> Hi Philipp,
> 
> Thank you for the patch.
> 
> On Monday 26 May 2014 15:55:51 Philipp Zabel wrote:
> > Since (min_row_time - crop->width) can be negative, we have to do a signed
> > comparison here. Otherwise max_t casts the negative value to unsigned int
> > and sets min_hblank to that invalid value.
> > 
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> and applied to my tree. Do you see a need to fasttrack this to v3.16 or can it 
> be applied to v3.17 ? Should I CC stable ?

Thank you, no need to fasttrack this from my side.

regards
Philipp


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-28 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-26 13:55 [PATCH v2] [media] mt9v032: fix hblank calculation Philipp Zabel
2014-05-28 11:12 ` Laurent Pinchart
2014-05-28 14:37   ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).