Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1448817rwi; Mon, 31 Oct 2022 17:06:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yaIZms2zCASWUaGKeupLbDjFwun1rUWYRJMchRs3ABqOPzI7aJXq1AFcWT96908TavQ4j X-Received: by 2002:a17:906:dac9:b0:780:ab6f:591f with SMTP id xi9-20020a170906dac900b00780ab6f591fmr15627435ejb.77.1667261057164; Mon, 31 Oct 2022 17:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667261057; cv=none; d=google.com; s=arc-20160816; b=fHs9FGTe1UImXMUGnosRqpmZXAYNz/GXohV0qnl9m33vfi8yoIqi+5oKqWo+lCQlBT 7LZvFBZIO77TD1GS5crjcBRRIB/b/G4YWuoy3m+5+lCtQ9z/R5rGo0dvrneYoKgGp2N/ AEuIq5geBnEi8pO83l/Aoi9UKA267q7RiBSgt1gO36p2KCzVgxDp/6jJH1280Wam3M1q mvA3ZlxNgi4S/MsjQszZtNmAtPXndgy/6j2c6H3m+FophCfENvm9rI9El4HXH5ej+qHG bJjs3eJWKJX2d0QGypTZwy0GhUDM9B7dt0vr1x7zriP5YOhzArghHi1GZ2ih13V2z9w2 g3Mw== 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:date:subject:cc:to:from :dkim-signature; bh=d4LiAqleogBkG8NOm3VowQ575ICtW67soXi7PB0llYs=; b=wafCPror2YkrWYHeBWtEumQbYwwOVc7F22xfZ/ROkxZD4CmHfnwkfaFvqlurPV6MNP T2uC7HEP96De+x8j/AO46IYFUckPZ66Ld+eCcLxQB73hLh/1m2FDGtoaFqpXIpzqUQXo iOrDJA/jbWrNMz0f1+WXmR84tt2qoEb+4m2swR+yEv5/luA7pcnFLkzyK9rPUcj0bpnb BIQcylVPMM/FprUv7oHJNznatA0kKeJFx+hwhx0anlza/Z1ypE/pOrPOHoV5pOJ2kNMp 1Kdg3m9g1nMBkTTL/vpWoowZUtLOJJ98X6xpGxCOjt66upbEgjne30K7M691t2Beoll2 /fWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="cJK+/X3j"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a0564021f0500b0046184b7c4besi8864577edb.462.2022.10.31.17.03.43; Mon, 31 Oct 2022 17:04:17 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="cJK+/X3j"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbiJaXXA (ORCPT + 97 others); Mon, 31 Oct 2022 19:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiJaXWi (ORCPT ); Mon, 31 Oct 2022 19:22:38 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06ED715A10; Mon, 31 Oct 2022 16:22:18 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso236915wmb.0; Mon, 31 Oct 2022 16:22:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=d4LiAqleogBkG8NOm3VowQ575ICtW67soXi7PB0llYs=; b=cJK+/X3jEyeQ2Es1QFj2uoZp4BYmhWP4k+uzNhatrXacbRSw8ei+x9SzH+tX6LHt47 K7gUQPZCZ3+sptPPay8wgi2hNjQOQxQRF19KcxDIvek4UsSGXL/uAdZRlAHaLcHIV+I/ jJ5rULwV0ifD5e56vOt4a5LkbbbJsmoNcaGib5WIRQXGJt7iE453Fx2Sre0cAuISGAT5 alT9LvH5LgXUSIzJh6WLlO6ni1ZpuJKqhBVB1nJH4kvswHH+G2TUBi9UDrVg349YORUI Z1cL5q3KHLphyRQTRyRyKA7buTwK0muwHIVQmSUS5GehZ43ZDQZIpg2XdeNJ/qTv1fLy sd7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d4LiAqleogBkG8NOm3VowQ575ICtW67soXi7PB0llYs=; b=qNVibSlG2HHLzwRlKZZJOUCsdcKKyUE/9o16Yw9s/+VukkCud64voG5h4MGI8Nf7Vo hqy3q4dvrH3rn2kniM4e480FQvhSwlPs5mYCKhpSBXUPHES50cbtsfm19vxgQHBG4cjk rbDsH9xFe5hWYzOeUbuqBKE1a786Lz7q3GT6UrTSSYcpv8xN1vTZ31uU6QLaHMo6pa75 C6io1WqnTCUjJBHL6dXpUGUZTvFxSgsNy/dC7TkMfAgRbE5VR7a8ePEoWOMB24eRqyU5 b650papZhEd5Fwf0XL01SFhvIkm2S5LSl6xbu6vwtTus7AXsLrJanekwTky6vHTSmSgs W5pQ== X-Gm-Message-State: ACrzQf2066chCo994PDUAKfgalQbe12j+mGO51gF341vchTTX5OYVDPi ONvIeJe+oeteFa2Gpn8D6iuxPsPXE2cQc2JY X-Received: by 2002:a05:600c:4e45:b0:3cd:f141:b7d8 with SMTP id e5-20020a05600c4e4500b003cdf141b7d8mr9768739wmq.196.1667258536834; Mon, 31 Oct 2022 16:22:16 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:15da:d6ab:ec79:436]) by smtp.gmail.com with ESMTPSA id l24-20020a1c7918000000b003cf7928e731sm2190343wme.9.2022.10.31.16.22.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 16:22:16 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: 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 Cc: Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v4 8/9] media: i2c: ov5645: Make sure to call PM functions Date: Mon, 31 Oct 2022 23:22:01 +0000 Message-Id: <20221031232202.131945-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221031232202.131945-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20221031232202.131945-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Lad Prabhakar Make sure we call the PM functions while s_stream(0) even in case of errors in the code flow. 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 --- v3->v4 * Fixed comments pointed by Marco v2->v3 * Now propagating the first error code in case of failure. v1->v2 * New patch --- drivers/media/i2c/ov5645.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index 6897f542737a..0a889283da36 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -998,15 +998,12 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) } else { ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40); if (ret < 0) - return ret; + goto stream_off_rpm_put; ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0, OV5645_SYSTEM_CTRL0_STOP); - if (ret < 0) - return ret; - pm_runtime_mark_last_busy(ov5645->dev); - pm_runtime_put_autosuspend(ov5645->dev); + goto stream_off_rpm_put; } return 0; @@ -1014,6 +1011,11 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) err_rpm_put: pm_runtime_put_sync(ov5645->dev); return ret; + +stream_off_rpm_put: + pm_runtime_mark_last_busy(ov5645->dev); + pm_runtime_put_autosuspend(ov5645->dev); + return ret; } static const struct v4l2_subdev_video_ops ov5645_video_ops = { -- 2.25.1