Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3694476pxb; Mon, 24 Jan 2022 15:34:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXsJiGn++dkADIZ+qFEIrvdMzCHvPVcVU9igKoawAXbycbeNkY9AqH4UJ1GTc1yQ5mLs1V X-Received: by 2002:a17:902:bb87:b0:148:a2f7:9d8e with SMTP id m7-20020a170902bb8700b00148a2f79d8emr16079611pls.173.1643067274080; Mon, 24 Jan 2022 15:34:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067274; cv=none; d=google.com; s=arc-20160816; b=UYDjECP5Gk9qMFAJpMg5aNg8FSHBl0c+o7rgHTeVZpvGfVn/afOLLJmhfN9xwSFwt6 zwMuRc2EDOb/7muAPAXEbHmU0MfDfTLritwZ/qAQwoKlfhft1YiZcw2NQx+gcR2LYuzj Se4sdN2O6+owH2qxrTdWoWeaGH/+A1jaGnBEfvPB3xItzdaBhGD6eHw4J0VZubWKrZmF B0ojbLQDHn0v/pl7A+bIaG+3D+hk98h3PqqZipkNLDRAyZzgnYwAtqRlP6umPWI0WI0+ MTUbyMCYB4DwzLT4F1qq+/HuZA3Z3BQWCuHcsWXrCuhDiQI6qTv8cFswVGkI/kET57rO Tt3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2BHsJXeFLKEe8udwOzs/fH1ekRK5w4CjUbnbuNkG548=; b=NGbrx4QBEITWYB04xA+99wi/MLcEpfOJdV1N6y0hC3mRO9Y4avuD0VQaEt/cecz3oC ZrvBqaW5GwAf8PIxUOHnJY4THH1cphE3Oo5NUGEZoqRST2kGcgE9oQEsDX/PvMOSLFaN 0E/OGGQGyNcysZQ8uvjGaoaJfNDJtDjA788B9lNn6OekDGIvmPXcCbfGIxZRmzlOlNlW I4yq2a1ByjKWk3fHcul4AXOo7hogJnNtX1vc8M6qaCsCokFcYIqbEpvve0g8D5QVX6bm zbCwQ1cd1CNheK+YfQY7tzSf1n5edPrhWVVJe+d6aQ4fpLV0t5ZHMFe+XDW8hAeG6ODu azyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mguJWQtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si14673659pga.541.2022.01.24.15.34.21; Mon, 24 Jan 2022 15:34:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mguJWQtV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849659AbiAXX0Y (ORCPT + 99 others); Mon, 24 Jan 2022 18:26:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835949AbiAXWhu (ORCPT ); Mon, 24 Jan 2022 17:37:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16EF2C0E9BB8; Mon, 24 Jan 2022 13:00:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AAC5861320; Mon, 24 Jan 2022 21:00:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AAABC340E5; Mon, 24 Jan 2022 21:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058027; bh=5CefI8kLlzwKiG7jZGtST77aCSVR1qeHJlatpgTEvLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mguJWQtVLjqWfMZ0C3r+TLCcSe7RHMUbwljXjjQGcbcPUSrRjuah+hCa6rrpCeqBP pO59L/3p/sLQCPYH9WoWqN0dlOOZGteRFrcLrYaSh0Sy3i7pH75gYKHA+VvFOMIMTQ nnyepxo9RP3o2Umx9n6zDU/ccs0AEFKNEDF87NDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tsuchiya Yuto , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0124/1039] media: atomisp: do not use err var when checking port validity for ISP2400 Date: Mon, 24 Jan 2022 19:31:53 +0100 Message-Id: <20220124184129.313744301@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tsuchiya Yuto [ Upstream commit 9f6b4fa2d2dfbff4b8a57eeb39b1128a6094ee20 ] Currently, the `port >= N_CSI_PORTS || err` checks for ISP2400 are always evaluated as true because the err variable is set to `-EINVAL` on declaration but the variable is never used until the evaluation. Looking at the diff of commit 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version"), the `port >= N_CSI_PORTS` check is for ISP2400 and the err variable check is for ISP2401. Fix this issue by adding ISP version test there accordingly. Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version") Signed-off-by: Tsuchiya Yuto Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index 483d40a467c74..65fc93c5d56bc 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -430,7 +430,8 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, assert(port < N_CSI_PORTS); - if (port >= N_CSI_PORTS || err) { + if ((!IS_ISP2401 && port >= N_CSI_PORTS) || + (IS_ISP2401 && err)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "allocate_mipi_frames(%p) exit: error: port is not correct (port=%d).\n", pipe, port); @@ -559,7 +560,8 @@ free_mipi_frames(struct ia_css_pipe *pipe) assert(port < N_CSI_PORTS); - if (port >= N_CSI_PORTS || err) { + if ((!IS_ISP2401 && port >= N_CSI_PORTS) || + (IS_ISP2401 && err)) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "free_mipi_frames(%p, %d) exit: error: pipe port is not correct.\n", pipe, port); @@ -670,7 +672,8 @@ send_mipi_frames(struct ia_css_pipe *pipe) assert(port < N_CSI_PORTS); - if (port >= N_CSI_PORTS || err) { + if ((!IS_ISP2401 && port >= N_CSI_PORTS) || + (IS_ISP2401 && err)) { IA_CSS_ERROR("send_mipi_frames(%p) exit: invalid port specified (port=%d).\n", pipe, port); return err; -- 2.34.1