From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>,
linux-media@vger.kernel.org
Subject: Re: [PATCH] [media] mt9v032: fix hblank calculation
Date: Mon, 26 May 2014 14:56:16 +0200 [thread overview]
Message-ID: <10306015.xT1Dl4KFnB@avalon> (raw)
In-Reply-To: <1400831277-2108-1-git-send-email-p.zabel@pengutronix.de>
Hi Philipp,
Thank you for the patch.
On Friday 23 May 2014 09:47:57 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>
> ---
> drivers/media/i2c/mt9v032.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> index 40172b8..4d7afad 100644
> --- a/drivers/media/i2c/mt9v032.c
> +++ b/drivers/media/i2c/mt9v032.c
> @@ -305,7 +305,7 @@ 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,
> + min_hblank = max_t(int, (int)mt9v032->model->data->min_row_time
> - crop->width, (int)min_hblank);
As max_t now casts to int, wouldn't it make sense to remove the manual casts
on both operands ? The first one is useless anyway, as the compiler will cast
mt9v032->model->data->min_row_time back to an unsigned int as crop->width is
unsigned.
> hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2014-05-26 12:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-23 7:47 [PATCH] [media] mt9v032: fix hblank calculation Philipp Zabel
2014-05-26 12:56 ` Laurent Pinchart [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10306015.xT1Dl4KFnB@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=p.zabel@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox