From patchwork Mon Dec 11 17:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Rudenko X-Patchwork-Id: 176854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7230983vqy; Mon, 11 Dec 2023 09:52:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEj0kOmo9sPPJyG48pluXnv9MnzZzMlwCjRopuKLXlC4Dv4C2F/yCLmiGwVcDshwDx60Q/i X-Received: by 2002:a17:90a:ebc6:b0:286:9cc1:a24 with SMTP id cf6-20020a17090aebc600b002869cc10a24mr2088220pjb.12.1702317155653; Mon, 11 Dec 2023 09:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702317155; cv=none; d=google.com; s=arc-20160816; b=ITGH5t346fVZo6AeewKKCIo04CXje9EEGmBoymLkNzlyeZ7h2lI3YXmRG1qRR+PzCU ca9kvlo2W73IOg+tNbpWbXUG8dWA0Olyaxwlc6PY9GiMgfUtFjlFYhEEktax4JS0m7Hh pkNdjexaZQdOBfFi7kmL9U9HI9a+hre3TV1+ZqlHRcpzr9gHonrYsi6O7kFd1ti7ACQZ v6kvN9ZqjGEEllwgiONxrhQFX9lnkrjBTssTo1zCzj6Lx006vrxtgvgzESOYwc/guWQx Qh3sruu/KwdCnzyNjOJmpuDVtKJwk8soNdzZb5dgHkwC6yg2v361R7ZYiBKFdSeoIhr9 nOIQ== 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=U1YDTnus4TPxjUF248/sdbNAm7YGCStl7FgqnfZm760=; fh=fWwPNk1JCACPIViZY2QlWlGqVImCQC9sYxd2Gp7QPV0=; b=k/aOAdatNU4+pgdJzTjj/YvhmJS875YeaQJYPkKBP2OH9k0dtWTmJsNnJnwnXIMu8l joCN0jqlEbFkXA5ovpLnI7e8OzkBuS7bwoGjCkyj0d8UgaCT5CZcpHUo1j/Kk0/nGx68 Z4Y+RvwgzbzYVX0xozP5dekZS5rZIgRR6utc6JvQKWELIEHEHhJ5+dZtWRMsoLg2yZga 0gzUlujCkf7UU5SU619B3t/q28M4ozrBaisPv53Z0OXD9X8cbMJjqMpUrzR4flEQi5yL 4H9Cck9amB6MVXIW1Prq3oF8hOqlVP6CBJO/DPE1cB2bjJ7GZyEY5JFx52D0SM3eBQjd 2vjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HvQLV7n0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id y2-20020a17090a86c200b0028675cb4aeasi7594810pjv.47.2023.12.11.09.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:52:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HvQLV7n0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8F59280413AA; Mon, 11 Dec 2023 09:52:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235044AbjLKRwF (ORCPT + 99 others); Mon, 11 Dec 2023 12:52:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235034AbjLKRvn (ORCPT ); Mon, 11 Dec 2023 12:51:43 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE60139; Mon, 11 Dec 2023 09:51:09 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50bfd7be487so5404582e87.0; Mon, 11 Dec 2023 09:51:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702317067; x=1702921867; darn=vger.kernel.org; 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=U1YDTnus4TPxjUF248/sdbNAm7YGCStl7FgqnfZm760=; b=HvQLV7n0+0kL/JkTnuruE2QH57SRtUBKq23ypn64xAT4uCP41PoWG6JE2M/pQKWg70 WUPQwJ+/R5dxsLkx3nScegHTWcGqDnNhTG37g59LXT+19QS13Y52f5jvZ6D/mT/XTXZR X5khxPJNsPpad5cIHWC2LOVuKbaytE6q09z8OE5K2k5FJdSbXbkd1z7M0wNaL8/uGgiL xNZZ3aep/hCyMAahsq1aWLGoSBQFQmdYX8KRZhh559sj2otiO9FHZGCq+2iuCjTT4xuO xlthv1YwJnybr/G+ZnlizzUz7GpLcuPVq1f1YBT+/ES6Sn/jMnCNx4pztpDj5rFXzq+U cUbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702317067; x=1702921867; 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=U1YDTnus4TPxjUF248/sdbNAm7YGCStl7FgqnfZm760=; b=iywDbUfYCaFIoNmC23gbarIxewmP7HIXrP5JIv4+Bk3Tt+hOeDwK0/TX+UVnzR/jQK 5FY/3BCw//A2ZGDC6gcDQ3LHPDavRVNztFCWwEd7uKPVM89aGC/1K80zWWlsumJXI3tC neR2kfODxukqlEuVK8144f7UeNJcCq0/CR0JMdrFCtI7+5tsUFfYDTbmBdLFrLi105wQ cQPmsL3Y6KZcR6NHAu+tyrAoY5k1kcQgXkMR1o3X3uPtMq7EwINzbnplHKQRft7850EC CFTMznCLU3YSm+q1HuO80/AwC4TRXNDUIP7kPPJLVe2zmG/dJmf+L0vHBTsH9HaEVGRh UCOg== X-Gm-Message-State: AOJu0YxFYUsg5TB2BviCcac6ESfqDvt6ELIQLlzZM2XowUcYxrTcqPek VBYLbfE1+UVi+oyBHyDe017qgh9zrM668vFI X-Received: by 2002:a05:6512:3112:b0:50b:fda6:9135 with SMTP id n18-20020a056512311200b0050bfda69135mr1973338lfb.101.1702317066908; Mon, 11 Dec 2023 09:51:06 -0800 (PST) Received: from localhost ([83.149.246.185]) by smtp.gmail.com with ESMTPSA id v25-20020ac25939000000b0050bef1c5b39sm1153777lfi.61.2023.12.11.09.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:51:06 -0800 (PST) From: Mikhail Rudenko To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sakari Ailus , Laurent Pinchart , Jacopo Mondi , Tommaso Merciai , Christophe JAILLET , Dave Stevenson , Mauro Carvalho Chehab , Mikhail Rudenko Subject: [PATCH 18/19] media: i2c: ov4689: Refactor ov4689_s_stream Date: Mon, 11 Dec 2023 20:50:21 +0300 Message-ID: <20231211175023.1680247-19-mike.rudenko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211175023.1680247-1-mike.rudenko@gmail.com> References: <20231211175023.1680247-1-mike.rudenko@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 11 Dec 2023 09:52:26 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785008913862284457 X-GMAIL-MSGID: 1785008913862284457 Remove repetitive pm_runtime_put calls in ov4689_s_stream function, and call pm_runtime_put once at the end of the "on" branch if any error occurred. Signed-off-by: Mikhail Rudenko --- drivers/media/i2c/ov4689.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/media/i2c/ov4689.c b/drivers/media/i2c/ov4689.c index e21527ae0b10..034bd9077a3a 100644 --- a/drivers/media/i2c/ov4689.c +++ b/drivers/media/i2c/ov4689.c @@ -555,35 +555,26 @@ static int ov4689_s_stream(struct v4l2_subdev *sd, int on) ov4689_common_regs, ARRAY_SIZE(ov4689_common_regs), NULL); - if (ret) { - pm_runtime_put(dev); - goto unlock_and_return; - } + if (ret) + goto cleanup_pm; ret = ov4689_setup_timings(ov4689, sd_state); - if (ret) { - pm_runtime_put(dev); - goto unlock_and_return; - } + if (ret) + goto cleanup_pm; ret = ov4689_setup_blc_anchors(ov4689, sd_state); - if (ret) { - pm_runtime_put(dev); - goto unlock_and_return; - } + if (ret) + goto cleanup_pm; ret = __v4l2_ctrl_handler_setup(&ov4689->ctrl_handler); - if (ret) { - pm_runtime_put(dev); - goto unlock_and_return; - } + if (ret) + goto cleanup_pm; ret = cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE, OV4689_MODE_STREAMING, NULL); - if (ret) { +cleanup_pm: + if (ret) pm_runtime_put(dev); - goto unlock_and_return; - } } else { cci_write(ov4689->regmap, OV4689_REG_CTRL_MODE, OV4689_MODE_SW_STANDBY, NULL);