Commit f17bc3f4 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] mt9v032: fix hblank calculation

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.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent e9b5872c
...@@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt9v032) ...@@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt9v032)
if (mt9v032->version->version == MT9V034_CHIP_ID_REV1) if (mt9v032->version->version == MT9V034_CHIP_ID_REV1)
min_hblank += (mt9v032->hratio - 1) * 10; 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, mt9v032->model->data->min_row_time - crop->width,
(int)min_hblank); min_hblank);
hblank = max_t(unsigned int, mt9v032->hblank, min_hblank); hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank); return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment