Skip to contentSkip to conversation

media: staging/intel-ipu3: Fix err handle of ipu3_css_find_binary

PATCH In review YueHaibing 3 participants 4 messages Dec 29, 2018 – Jan 8, 2019

Subsystems (3)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 media: staging/intel-ipu3: Fix err handle of ipu3_css_find_binary

'bindex' is unsigned, it never less than zero.
This patch bring int 'binary' back to handle the err condition.

Fixes 51abe041c5ed ("media: staging/intel-ipu3: Add dual pipe support")
---
 drivers/staging/media/ipu3/ipu3-css.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/media/ipu3/ipu3-css.c +4 -4
index 44c5563..28f0c02 100644
@@ -1751,7 +1751,7 @@ int ipu3_css_fmt_try(struct ipu3_css *css,
 					&q[IPU3_CSS_QUEUE_OUT].fmt.mpix;
 	struct v4l2_pix_format_mplane *const vf =
 					&q[IPU3_CSS_QUEUE_VF].fmt.mpix;
-	int i, s;
+	int i, s, binary;
 
 	/* Adjust all formats, get statistics buffer sizes and formats */
 	for (i = 0; i < IPU3_CSS_QUEUES; i++) {
@@ -1826,13 +1826,13 @@ int ipu3_css_fmt_try(struct ipu3_css *css,
 	s = (bds->height - gdc->height) / 2 - FILTER_SIZE;
 	env->height = s < MIN_ENVELOPE ? MIN_ENVELOPE : s;
 
-	css->pipes[pipe].bindex =
-		ipu3_css_find_binary(css, pipe, q, r);
-	if (css->pipes[pipe].bindex < 0) {
+	binary = ipu3_css_find_binary(css, pipe, q, r);
+	if (binary < 0) {
 		dev_err(css->dev, "failed to find suitable binary\n");
 		return -EINVAL;
 	}
 
+	css->pipes[pipe].bindex = binary;
 	dev_dbg(css->dev, "Binary index %d for pipe %d found.",
 		css->pipes[pipe].bindex, pipe);
 
Signature · 1 line
2.7.0
maintainer
#2 lore raw

Hi Bingbu,

Quoted 7 lines · Bingbu Cao

Hi, Haibing

Thanks for your patch, it looks fine for me.

Quoted 1 line · YueHaibing

css->pipes[pipe].bindex = binary;

I'm taking Colin's patch with equivalent content; it was there first.

Thanks!

Signature · 2 lines
Sakari Ailus
[email protected]
#3 lore raw
Quoted 11 lines · Sakari Ailus

Hi Bingbu,

Quoted 7 lines · Bingbu Cao

Hi, Haibing

Thanks for your patch, it looks fine for me.

Quoted 1 line · YueHaibing

css->pipes[pipe].bindex = binary;

I'm taking Colin's patch with equivalent content; it was there first.

Sakari, good to know that, thanks!

Quoted 3 lines

Thanks!