From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 944C871 for ; Wed, 5 May 2021 11:28:18 +0000 (UTC) Received: from fraeml702-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4FZv1x4l78z6yj64; Wed, 5 May 2021 19:02:45 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml702-chm.china.huawei.com (10.206.15.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 5 May 2021 13:08:33 +0200 Received: from localhost (10.52.120.138) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 5 May 2021 12:08:32 +0100 Date: Wed, 5 May 2021 12:06:52 +0100 From: Jonathan Cameron To: Mauro Carvalho Chehab CC: , , Fabio Estevam , Greg Kroah-Hartman , "Mauro Carvalho Chehab" , NXP Linux Team , Pengutronix Kernel Team , Philipp Zabel , Rui Miguel Silva , Sascha Hauer , Shawn Guo , Steve Longerbeam , , , , Subject: Re: [PATCH 02/25] staging: media: imx7-mipi-csis: fix pm_runtime_get_sync() usage count Message-ID: <20210505120652.00001236@Huawei.com> In-Reply-To: <793a5806a63b6313606fd1c344b9eec41e61a440.1620207353.git.mchehab+huawei@kernel.org> References: <793a5806a63b6313606fd1c344b9eec41e61a440.1620207353.git.mchehab+huawei@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.120.138] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected On Wed, 5 May 2021 11:41:52 +0200 Mauro Carvalho Chehab wrote: > The pm_runtime_get_sync() internally increments the > dev->power.usage_count without decrementing it, even on errors. > Replace it by the new pm_runtime_resume_and_get(), introduced by: > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > in order to properly decrement the usage counter, avoiding > a potential PM usage counter leak. > > Acked-by: Rui Miguel Silva > Signed-off-by: Mauro Carvalho Chehab Not a fix as far as I can see, just a cleanup - so perhaps not this set? Jonathan > --- > drivers/staging/media/imx/imx7-mipi-csis.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c > index 025fdc488bd6..1dc680d94a46 100644 > --- a/drivers/staging/media/imx/imx7-mipi-csis.c > +++ b/drivers/staging/media/imx/imx7-mipi-csis.c > @@ -695,11 +695,10 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) > > mipi_csis_clear_counters(state); > > - ret = pm_runtime_get_sync(&state->pdev->dev); > - if (ret < 0) { > - pm_runtime_put_noidle(&state->pdev->dev); > + ret = pm_runtime_resume_and_get(&state->pdev->dev); > + if (ret < 0) > return ret; > - } > + > ret = v4l2_subdev_call(state->src_sd, core, s_power, 1); > if (ret < 0 && ret != -ENOIOCTLCMD) > goto done; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 278AEC433ED for ; Wed, 5 May 2021 11:10:54 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7EE40613C7 for ; Wed, 5 May 2021 11:10:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EE40613C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=Huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WoAUgREg7KPyRuNMCxLosi9IuZHJ1BZfw4NdtuDNZVw=; b=bMkxZ2Fu5NvVeej82UKXrLgXT b26FBzWclZH6mDcJYASTAESi4C8Z5v0sLU7JwPo8Tlb2ri7TjDVOUSfrH0pq1nXtdsYEBjdthVJUy TNQAxYYT1kM6jb80Y20MxNSWpKUEpOdX0asUYo1o+SPUvoMlzU6QbFZTAm4GrmegNqCCHQibmC0al WmRKdFmm3QVqxGJYCocMxQXymlVVh2WvFnzctUqoHqiz5Dy5j5G0Yp+Sx5ETMQo2XeqFn5WC27jFs EeMYieN3j62RGU3UldB7oQ83dIkcV1ddVDr4hFWtkOdvkdUIsGmQl1aWn5gfi9KmhXQ/9k2S9zpHv fgRACTTiw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leFOc-0013eN-BE; Wed, 05 May 2021 11:08:52 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leFOZ-0013e6-Ez for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 11:08:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:CC:To: From:Date:Sender:Reply-To:Content-ID:Content-Description; bh=FDZfgsJ1gPftCeo0SK5QDLtnqTcdLO+IwhM/uBbH7yo=; b=KcodE8OT2Q18BNrV4zSosxQYvA oQb68Rtb6wEgFBGksSK3CP0AOrDC+/0EMWPdfv5W+vVHSjebLvB+lp0ByRNh0tt2tm5cblh49/8CX vtfGq/ea4bFwwjE3/s8zmgg44z+5O1BDKS8clgL47ODkvqvESpY/3dYB5Cc6emrtYWEPFRLPyLGPI IKaquuLV4TLnGx0QnvtfM2lsmV3cAG490vJg2WLxCYTYkn7JKlN4Rn/95wpdA+haHDAgE4iubREXA amgXARIXmbtwqz/5kHNm/c3lqS8lsOH/TNXn37tnPDQYqVhgd5aBCsYuavstOqtnUXUmyvU1kwA83 ln+gcTfA==; Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leFOW-004h7b-KJ for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 11:08:46 +0000 Received: from fraeml702-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4FZv1x4l78z6yj64; Wed, 5 May 2021 19:02:45 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml702-chm.china.huawei.com (10.206.15.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 5 May 2021 13:08:33 +0200 Received: from localhost (10.52.120.138) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 5 May 2021 12:08:32 +0100 Date: Wed, 5 May 2021 12:06:52 +0100 From: Jonathan Cameron To: Mauro Carvalho Chehab CC: , , Fabio Estevam , Greg Kroah-Hartman , "Mauro Carvalho Chehab" , NXP Linux Team , Pengutronix Kernel Team , Philipp Zabel , Rui Miguel Silva , Sascha Hauer , Shawn Guo , Steve Longerbeam , , , , Subject: Re: [PATCH 02/25] staging: media: imx7-mipi-csis: fix pm_runtime_get_sync() usage count Message-ID: <20210505120652.00001236@Huawei.com> In-Reply-To: <793a5806a63b6313606fd1c344b9eec41e61a440.1620207353.git.mchehab+huawei@kernel.org> References: <793a5806a63b6313606fd1c344b9eec41e61a440.1620207353.git.mchehab+huawei@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.52.120.138] X-ClientProxiedBy: lhreml725-chm.china.huawei.com (10.201.108.76) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_040844_821620_B46FADF5 X-CRM114-Status: GOOD ( 16.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 5 May 2021 11:41:52 +0200 Mauro Carvalho Chehab wrote: > The pm_runtime_get_sync() internally increments the > dev->power.usage_count without decrementing it, even on errors. > Replace it by the new pm_runtime_resume_and_get(), introduced by: > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > in order to properly decrement the usage counter, avoiding > a potential PM usage counter leak. > > Acked-by: Rui Miguel Silva > Signed-off-by: Mauro Carvalho Chehab Not a fix as far as I can see, just a cleanup - so perhaps not this set? Jonathan > --- > drivers/staging/media/imx/imx7-mipi-csis.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c > index 025fdc488bd6..1dc680d94a46 100644 > --- a/drivers/staging/media/imx/imx7-mipi-csis.c > +++ b/drivers/staging/media/imx/imx7-mipi-csis.c > @@ -695,11 +695,10 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) > > mipi_csis_clear_counters(state); > > - ret = pm_runtime_get_sync(&state->pdev->dev); > - if (ret < 0) { > - pm_runtime_put_noidle(&state->pdev->dev); > + ret = pm_runtime_resume_and_get(&state->pdev->dev); > + if (ret < 0) > return ret; > - } > + > ret = v4l2_subdev_call(state->src_sd, core, s_power, 1); > if (ret < 0 && ret != -ENOIOCTLCMD) > goto done; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel