Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1112233rwi; Wed, 26 Oct 2022 10:55:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7g7GyQagY8okvCjHea482NY5Ysme6Wq25YtWWIKgOIMrG1eSRGlVWNXlCCjOOmVJp9u+Px X-Received: by 2002:a63:464d:0:b0:441:5968:cd0e with SMTP id v13-20020a63464d000000b004415968cd0emr3639888pgk.595.1666806910710; Wed, 26 Oct 2022 10:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666806910; cv=none; d=google.com; s=arc-20160816; b=jXq50mYZOHWMi1WGnhcAgXy/pUBrfIuUNTTr3YQke+1R8kNo8vTaxHjn8NnIqNd945 L7IKY2A9zeDUEWq7HCNQh1Wy1XVocMNvY3qwrMceN8fddYhVVpiLpsFVGvPqeZScNlfJ 5Py80cgCf1qkrwo2ZtZo0zWy+1AtgkdtM+lWRsS1H2d7zywLjPzKovtGKFwz7YHNtJjJ iqTfpnIMBDO4X1+X0HoxLnh3ui/pNA8d9PEQwQXz9DgmdD6J1ztGWu2H9ZfWQ/QNBAZO MhxBLKX0dNDFvihj4qN5Tf57juJu1J9Y2RzqtzJxeo4xyAXclYSB03Zic7m8goumK7Ol fdwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iMpvTIAyLDYPXbIGpfyuzoSSIgzq/PVywx2vMNNVgPE=; b=MzHuXwvsiwdbmiK/KvhftOmCQR8FeXSveEMmEIQ1hN7CkuxRtET3q+P0Qp5OCmELOg dNXIbwcC2cxSESEajvOBZCIRcD/WPXte+XF/5LJsu4httgU9QdFzSlxaumBtWIcn7EXk chNs5cTCuIudyDPZj6LT4zuuobRYfikMPtaReG/DdXMdYPjthPRaQa8D/yxhXyjyxf2l X73xjwA7gXQGu2kbUYpAMdxk0G6WGERoeg4XOSdaVxdEVSr1Txt3fXmVPWpoGqFNTlfK 1m+yYv9HvPh7tJAlIRaFUR3tXBrp7qUWul8Hnyg/OcCp8mBHlB4v2nL7dzy/EZLnMwei fRSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf23-20020a656d17000000b00461d9cce57dsi7539936pgb.254.2022.10.26.10.54.58; Wed, 26 Oct 2022 10:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbiJZRSK (ORCPT + 99 others); Wed, 26 Oct 2022 13:18:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbiJZRSJ (ORCPT ); Wed, 26 Oct 2022 13:18:09 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76E28844EA for ; Wed, 26 Oct 2022 10:18:08 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1onk1s-0003AO-MF; Wed, 26 Oct 2022 19:17:24 +0200 Received: from mfe by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1onk1p-0005PJ-NT; Wed, 26 Oct 2022 19:17:21 +0200 Date: Wed, 26 Oct 2022 19:17:21 +0200 From: Marco Felsch To: Prabhakar Cc: Sakari Ailus , Laurent Pinchart , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Geert Uytterhoeven , Magnus Damm , Hans Verkuil , Shawn Tu , devicetree@vger.kernel.org, Jacopo Mondi , linux-kernel@vger.kernel.org, Lad Prabhakar , linux-renesas-soc@vger.kernel.org, Biju Das , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: Re: [PATCH v3 8/9] media: i2c: ov5645: Don't return early on failures for s_stream(0) Message-ID: <20221026171721.4nfvhamguwnrw6zf@pengutronix.de> References: <20221026130658.45601-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221026130658.45601-9-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221026130658.45601-9-prabhakar.mahadev-lad.rj@bp.renesas.com> User-Agent: NeoMutt/20180716 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prabhakar, thanks for the patch, please see below my comments. On 22-10-26, Prabhakar wrote: > From: Lad Prabhakar > > Make sure we dont stop the code flow in case of errors while stopping > the stream and return the error code of the first error case if any. > > v4l2-core takes care of warning the user so no need to add a warning > message in the driver. > > Suggested-by: Sakari Ailus > Signed-off-by: Lad Prabhakar > --- > v2->v3 > * Now propagating the first error code in case of failure. > > v1->v2 > * New patch > --- > drivers/media/i2c/ov5645.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c > index eea3067ddc8b..5702a55607fc 100644 > --- a/drivers/media/i2c/ov5645.c > +++ b/drivers/media/i2c/ov5645.c > @@ -996,17 +996,22 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) > if (ret < 0) > goto err_rpm_put; > } else { > + int stream_off_ret = 0; > + > ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40); If this write failed.. > if (ret < 0) > - return ret; > + stream_off_ret = ret; > > ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0, > OV5645_SYSTEM_CTRL0_STOP); why should this write be successful? Regards, Marco > - if (ret < 0) > - return ret; > + if (ret < 0 && !stream_off_ret) > + stream_off_ret = ret; > > pm_runtime_mark_last_busy(ov5645->dev); > pm_runtime_put_autosuspend(ov5645->dev); > + > + if (stream_off_ret) > + return stream_off_ret; > } > > return 0; > -- > 2.25.1 > > >