Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp229165pxb; Mon, 8 Nov 2021 12:38:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyb4pNUd8KVXB6VqLtxSQ9Il8K3RqH6z9vh153exmItXFqWqzubuKld0bUsfcAQKIk8rOJZ X-Received: by 2002:a92:ddcc:: with SMTP id d12mr1424895ilr.28.1636403937572; Mon, 08 Nov 2021 12:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636403937; cv=none; d=google.com; s=arc-20160816; b=EMPjgTP6Bj2CUUhcgCF0K4VktdV0I/gjD5fGVYAMzTIBM7kPKeC4w60Z2E0/puuINX bfmEf76MDnr1iqYtjeNVXajzpnZxYOCsuFUMXOo/6Ii+n/Pbsz4XdUcbTLKg2d4luGJN wL/GVdpGdJdIqHc+IAZtVFOnknwsi3DIYvlXcjrBbIoqwjIMA18OzQ0Mo4YtwBhta//J F9J+txzIguze9mGXb4ruOknJpoLItsHVLKwDmP8H/U6qSfpJOH5ldWF7fYe6pqI02J1P P5AhOKlLqDvpjnBTIJo0WsNvMxbtU3Pk2QUaxLXZpO/NTxuWFagooPgWyasN1hC0GCXk BjZA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=DTXJKzI3gZ+GY4mDa152qWEbjZSDrk4rp+e46TMQ+Ns=; b=Xv/2WKY15fqaxWfTNS/wXFoQyDHNnnMQun1g7O1AfiYaD2k4GcP/dh+J2krApXbISx ezuujyHRfUVScu5W0u+NFWY6PU2HbJ/aaoOPCEstgvuMp32o5M9JQu6UN2/U8OVrsyHb cuP5uSIwQbpbYLZnxJTJ6+iDwbgy4HBXdoL8lZQys4IAt4lWNHaA3Ilnr4Qck1Q9cb9X 5tz306eHkmf/YaG/sVvj05N8YFp+W6bp+YTQS+tPsKduLQp5UvGrsCLNxV5vZ4Sda1f2 YBxQQQJ3hWV0d5293h+z75IQP4YRWU8baaX1dEj/JRFDZu+YqkBz3aMw7i36rmb7CyWF OVbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S0KOIoF5; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si35789934iov.84.2021.11.08.12.38.22; Mon, 08 Nov 2021 12:38:57 -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=@kernel.org header.s=k20201202 header.b=S0KOIoF5; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240044AbhKHQij (ORCPT + 99 others); Mon, 8 Nov 2021 11:38:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:34230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237949AbhKHQii (ORCPT ); Mon, 8 Nov 2021 11:38:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C9E361378; Mon, 8 Nov 2021 16:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636389353; bh=iwpvDLswxle6gd8V8J2IbfFUIvkB+LSqibNQ3NEZosU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=S0KOIoF5/TzLjdBfvZr2p1stIlRfTaafAcfC9DaVaNh6xr0cY2KWzFS7ABRnpAQGh fOLNKEHnQwrWJ+/ywwjNO2DaGE2+0VClp5Lbu+18h2RHN92o3zKfqqb9qU2zAT83zN iqMg1aee4z8ldz1AnuV7QU8a4BPdQ+ZjNac0x39+byise7d3mgrP5BoynbgHZrobKV pji3zBShOJKAPe9nKzryPU04Fo/TWY/P91adQjC17DoHaEoVtpTDQegHshOoMOp4Or SnyLfa6lCJnGDxaKHTX9zbMA55/gKnqRfNiQTG3uI8MS/+qcZj4+VgokgHLykVNGWl u8mX/q/LcfgTg== Date: Mon, 8 Nov 2021 16:35:47 +0000 From: Mauro Carvalho Chehab To: Tsuchiya Yuto Cc: Dan Carpenter , Hans de Goede , Patrik Gfeller , Sakari Ailus , Greg Kroah-Hartman , Hans Verkuil , Aline Santana Cordeiro , Yang Yingliang , Dinghao Liu , Deepak R Varma , Alex Dewar , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/17] media: atomisp: pci: fix inverted error check for ia_css_mipi_is_source_port_valid() Message-ID: <20211108163536.07bd2282@sal.lan> In-Reply-To: References: <20211017161958.44351-1-kitakar@gmail.com> <20211017161958.44351-6-kitakar@gmail.com> <20211102113332.GC2794@kadam> <20211108151455.GI2001@kadam> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, 09 Nov 2021 00:25:52 +0900 Tsuchiya Yuto escreveu: > > > On Mon, 2021-11-08 at 18:14 +0300, Dan Carpenter wrote: > > On Tue, Nov 09, 2021 at 12:00:29AM +0900, Tsuchiya Yuto wrote: > > > On Tue, 2021-11-02 at 14:33 +0300, Dan Carpenter wrote: > > > > On Mon, Oct 18, 2021 at 01:19:45AM +0900, Tsuchiya Yuto wrote: > > > > > The function ia_css_mipi_is_source_port_valid() returns true if the port > > > > > is valid. So, we can't use the existing err variable as is. > > > > > > > > > > To fix this issue while reusing that variable, invert the return value > > > > > when assigning it to the variable. > > > > > > > > > > Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version") > > > > > Signed-off-by: Tsuchiya Yuto > > > > > --- > > > > > .../staging/media/atomisp/pci/sh_css_mipi.c | 24 ++++++++++++------- > > > > > 1 file changed, 15 insertions(+), 9 deletions(-) > > > > > > > > > > diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c > > > > > index 65fc93c5d56b..c1f2f6151c5f 100644 > > > > > --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c > > > > > +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c > > > > > @@ -423,10 +423,12 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, > > > > > return 0; /* AM TODO: Check */ > > > > > } > > > > > > > > > > - if (!IS_ISP2401) > > > > > + if (!IS_ISP2401) { > > > > > port = (unsigned int)pipe->stream->config.source.port.port; > > > > > - else > > > > > - err = ia_css_mipi_is_source_port_valid(pipe, &port); > > > > > + } else { > > > > > + /* Returns true if port is valid. So, invert it */ > > > > > + err = !ia_css_mipi_is_source_port_valid(pipe, &port); > > > > > > > > Don't invert it... This isn't supposed to return 1 on failure it's > > > > supposed to return negative error codes. > > > > > > You mean I should instead modify the return value of > > > ia_css_mipi_is_source_port_valid() ? > > > > > > > No. ia_css_mipi_is_source_port_valid() is fine. It has a boolean name > > so returning bool is fine. What I'm saying is that allocate_mipi_frames() > > should do: > > > > if (!ia_css_mipi_is_source_port_valid(pipe, &port)) > > err = -EINVAL; > > > > Otherwise it returns negative error codes and 1 on failure. > > Ah, I see! Thank you. I feel I'm a stupid... I'll do so in v2. I would prefer if you could send such changes on new patches. Regards, Mauro