Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3384918pxy; Sun, 25 Apr 2021 23:54:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0HrbTRvwOp5aZd72H5fG38XSs3q/5vsBEVvXjSPp1o8lgU5EVXrH7NKqRr8GRf/436xwC X-Received: by 2002:a05:6a00:148c:b029:260:ef7c:3843 with SMTP id v12-20020a056a00148cb0290260ef7c3843mr16411086pfu.70.1619420064877; Sun, 25 Apr 2021 23:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619420064; cv=none; d=google.com; s=arc-20160816; b=qLiTVm8scwtfl8lh5J+e8kTjnu8p57vNj8VSt22WSNhiiXfBnTt7MH6FReQyuvtTm0 arGJGdoEGZHTrPnV9jh6oj962rrBvjPHeILuRUmsqmpMOSWW739jYId0aZUzL8YngZe8 C5b6ca7+WjGGqT+/DxjLuo6nli0GXmkw6bmCWfG121JdDv+4oyhlm7JAWucVXilzB3A8 m07mjpaaxdetPltOS37cbNFgH3n1j9AoJTylZNqvJO6PmtGcngGpmfAiChwa03XRh2BT Snx/VnERXLh3pyvOmI/a05AMWq9OINPzpK8GRto35oKdHe0x0Ci9SNDf9IZz+RIZOC0t AM+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=rG8V+z/WLbHvk+JxAk7a6dSOSU/Ib0J8pECYm81BVqE=; b=zfFYhbc9uGSqp046kJoMFzhGh6XIB1jFQwc/CvDm0nb0NveepsI1pDe3lq37yomTwP aOP6JFnmfCQmMcBSuNQ/59wqh2hA2O7WtqiP3Gh1ssuW+OjenSD9Bt8xQOC+IOKM/ZKq 49PjbvW79b8mzRJ1BuO2Tj+wD/mk3uOaW2/WWAiJp+IwC8GWN5Uuhsvwf+cFpj3iTplj 5O3Rgz+mryvfi79DfxvD7Wv4RD/DO2a+VZXqKNtcU6Lm+AzExpl4vwycYiWlaOAgMLqB AA7Z3VWhfMSclCaqMILLtAVzfQ76aB96l1PJFYDI17cUSEWHFbnbQCF4CB6DdMNFEiiy cQvA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j64si18156126pfb.142.2021.04.25.23.54.12; Sun, 25 Apr 2021 23:54:24 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231984AbhDZGyL convert rfc822-to-8bit (ORCPT + 99 others); Mon, 26 Apr 2021 02:54:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232013AbhDZGyK (ORCPT ); Mon, 26 Apr 2021 02:54:10 -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 A1BBEC061574 for ; Sun, 25 Apr 2021 23:53:29 -0700 (PDT) Received: from lupine.hi.pengutronix.de ([2001:67c:670:100:3ad5:47ff:feaf:1a17] helo=lupine) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lav7M-0003nv-L8; Mon, 26 Apr 2021 08:53:16 +0200 Received: from pza by lupine with local (Exim 4.92) (envelope-from ) id 1lav7K-00051L-VC; Mon, 26 Apr 2021 08:53:14 +0200 Message-ID: <3ef4238e7e173eb97017aa3d5af86ed578b7c294.camel@pengutronix.de> Subject: Re: [PATCH 56/78] media: coda: use pm_runtime_resume_and_get() From: Philipp Zabel To: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Date: Mon, 26 Apr 2021 08:53:14 +0200 In-Reply-To: <5102aef0e5d4ccfafed92087e3800ffaca4736ba.1619191723.git.mchehab+huawei@kernel.org> References: <5102aef0e5d4ccfafed92087e3800ffaca4736ba.1619191723.git.mchehab+huawei@kernel.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:3ad5:47ff:feaf:1a17 X-SA-Exim-Mail-From: p.zabel@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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mauro, On Sat, 2021-04-24 at 08:45 +0200, Mauro Carvalho Chehab wrote: > Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > added pm_runtime_resume_and_get() in order to automatically handle > dev->power.usage_count decrement on errors. > > Use the new API, in order to cleanup the error check logic. > > Signed-off-by: Mauro Carvalho Chehab > --- > drivers/media/platform/coda/coda-common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c > index bd666c858fa1..fea1c136a42c 100644 > --- a/drivers/media/platform/coda/coda-common.c > +++ b/drivers/media/platform/coda/coda-common.c > @@ -2660,7 +2660,7 @@ static int coda_open(struct file *file) > ctx->use_vdoa = false; > > /* Power up and upload firmware if necessary */ > - ret = pm_runtime_get_sync(dev->dev); > + ret = pm_runtime_resume_and_get(dev->dev); > if (ret < 0) { > v4l2_err(&dev->v4l2_dev, "failed to power up: %d\n", ret); > goto err_pm_get; There's a pm_runtime_put_sync() at the err_pm_get below, so the label needs to be moved down a line: @@ -2705,8 +2705,8 @@ static int coda_open(struct file *file) clk_disable_unprepare(dev->clk_ahb); err_clk_ahb: clk_disable_unprepare(dev->clk_per); -err_pm_get: pm_runtime_put_sync(dev->dev); +err_pm_get: v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); err_coda_name_init: regards Philipp