Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8968059imu; Sat, 29 Dec 2018 07:32:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4BfZdUkzEImhz/77DgOOSVwX075nEln8UHkJRa2+ufzNPM2KtGj/W1FyibHEHTQi0c0gqi X-Received: by 2002:a63:4246:: with SMTP id p67mr1934724pga.335.1546097562425; Sat, 29 Dec 2018 07:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546097562; cv=none; d=google.com; s=arc-20160816; b=qPACTsuRcm7qVJAk0NNygvHJXIok2F9FXXfpcRZtWoLKiwUW+KPsPx0w/7Nc+l9ZJr 6xBtK6ei8A1JK/3mYp3Hi//DX0po111bSbxaiJsf0FGExcQoEzPXoi/CdLWF0q/6KftY S5DkrrvnMtnN2J0hiMsrrwR+cjYlo6VY1diI+eWPIpTWrkoh4Sg6rmbPHTuDYAbqXGyT /N08y2/uhKQDB5JbtHLkOCOT7BFHCTXSx67UXpwULlXs1mo302SsOfQsdem/inpD9EmY ewPZHoqo+RAOS457scUWY9ienY/V+T/kz+/PYUirSVgi/0d1irE8bTr4Yth7Kle+k47E eigg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=oXZmYgSv5AQ4H/8X4QRxccFoa35v1s1mLJn6zWwQ3Jo=; b=W/EJZ/AGf7VrXo7PvTobscuZ5TQmNhxBRgudQBBUdLdAsJGUhEOE28rNpb1wMwQEUj nrg7iGo4gXYks3D3dfXi5qfIT3TEDNUiPWIIgsOLlvoMeHEg7AbEca1to6Rq9XV3F5ns 4wxX944mfHJtkYj21ivYGJHk2UAf0CtpdIY6YNetEMqzJ8GK6MdfFQ2Kqeol9ldV4LuP +4YSNxtrtbhsrmldfF4UN428RN8B0EdiMfW+yeTW0buiUK7BMAkmuWhREnueBfUAOPMo W943FV1t+kjjj5jAKAUFwsWeLeWVmlAo3e/WE97DDucWQ9e40jhiNICoc8TZDHTIZc1X ZtLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si40086894pgk.201.2018.12.29.07.32.24; Sat, 29 Dec 2018 07:32:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729946AbeL2Cqg (ORCPT + 99 others); Fri, 28 Dec 2018 21:46:36 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:58745 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727815AbeL2Cqg (ORCPT ); Fri, 28 Dec 2018 21:46:36 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DC9C1968DD1DA; Sat, 29 Dec 2018 10:46:32 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.408.0; Sat, 29 Dec 2018 10:46:24 +0800 From: YueHaibing To: , , CC: , , , YueHaibing Subject: [PATCH -next] media: staging/intel-ipu3: Fix err handle of ipu3_css_find_binary Date: Sat, 29 Dec 2018 10:45:28 +0800 Message-ID: <20181229024528.6016-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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") Signed-off-by: YueHaibing --- drivers/staging/media/ipu3/ipu3-css.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-css.c b/drivers/staging/media/ipu3/ipu3-css.c index 44c5563..28f0c02 100644 --- a/drivers/staging/media/ipu3/ipu3-css.c +++ b/drivers/staging/media/ipu3/ipu3-css.c @@ -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); -- 2.7.0