Commit 81a43d10 authored by Colin Ian King's avatar Colin Ian King Committed by Mauro Carvalho Chehab

media: staging: intel-ipu3: fix unsigned comparison with < 0

The comparison css->pipes[pipe].bindex < 0 is always false because
bindex is an unsigned int.  Fix this by using a signed integer for
the comparison.

Detected by CoverityScan, CID#1476023 ("Unsigned compared against 0")

Fixes: f5f2e427 ("media: staging/intel-ipu3: Add css pipeline programming")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 505ecd35
...@@ -1751,7 +1751,7 @@ int ipu3_css_fmt_try(struct ipu3_css *css, ...@@ -1751,7 +1751,7 @@ int ipu3_css_fmt_try(struct ipu3_css *css,
&q[IPU3_CSS_QUEUE_OUT].fmt.mpix; &q[IPU3_CSS_QUEUE_OUT].fmt.mpix;
struct v4l2_pix_format_mplane *const vf = struct v4l2_pix_format_mplane *const vf =
&q[IPU3_CSS_QUEUE_VF].fmt.mpix; &q[IPU3_CSS_QUEUE_VF].fmt.mpix;
int i, s; int i, s, ret;
/* Adjust all formats, get statistics buffer sizes and formats */ /* Adjust all formats, get statistics buffer sizes and formats */
for (i = 0; i < IPU3_CSS_QUEUES; i++) { for (i = 0; i < IPU3_CSS_QUEUES; i++) {
...@@ -1826,12 +1826,12 @@ int ipu3_css_fmt_try(struct ipu3_css *css, ...@@ -1826,12 +1826,12 @@ int ipu3_css_fmt_try(struct ipu3_css *css,
s = (bds->height - gdc->height) / 2 - FILTER_SIZE; s = (bds->height - gdc->height) / 2 - FILTER_SIZE;
env->height = s < MIN_ENVELOPE ? MIN_ENVELOPE : s; env->height = s < MIN_ENVELOPE ? MIN_ENVELOPE : s;
css->pipes[pipe].bindex = ret = ipu3_css_find_binary(css, pipe, q, r);
ipu3_css_find_binary(css, pipe, q, r); if (ret < 0) {
if (css->pipes[pipe].bindex < 0) {
dev_err(css->dev, "failed to find suitable binary\n"); dev_err(css->dev, "failed to find suitable binary\n");
return -EINVAL; return -EINVAL;
} }
css->pipes[pipe].bindex = ret;
dev_dbg(css->dev, "Binary index %d for pipe %d found.", dev_dbg(css->dev, "Binary index %d for pipe %d found.",
css->pipes[pipe].bindex, pipe); css->pipes[pipe].bindex, pipe);
......
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