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=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 A686FC43460 for ; Wed, 28 Apr 2021 14:54:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76F1961445 for ; Wed, 28 Apr 2021 14:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240618AbhD1OzE (ORCPT ); Wed, 28 Apr 2021 10:55:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:36356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240291AbhD1Oxa (ORCPT ); Wed, 28 Apr 2021 10:53:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21675614A7; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=W1MZ5fUp2z9NMPUzLbsMjuPOyaCJXem6s4s1Qkfcwz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2TOTcw5C445poYixO6MB4771lIkivCDk6l1WcyEeoHLXx/19d6xJ7PwFCbd9A7zF nvUAN9xfF2FVM2yBWLaiNmalMlFsxj5A/UBsSSi6eDtBqBG1TUqiwtAMuwwuBPz4Wa T6MVM6CztEmBDxh1mW/Jz/Xs5VyReq83re7kSzaJaSFdmsHDnc89Y8hn9PjRx1ehzZ OFEAxVTSyd6mB4N7MKW6xKmWnVg/yWiU0CN6VtsO3ruHXAhRALU0U9raQ1OvIeylA6 0nG8cb9T4w9p+CmQzNnwUlsyp9YqwWAVvIbjdlCaN70KmHaX5tX8q8E6rdVLzQeGTA +JpqFWntku3vg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001DqV-3i; Wed, 28 Apr 2021 16:52:42 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Mauro Carvalho Chehab , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v4 19/79] media: sunxi: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51:40 +0200 Message-Id: <17cf60c9e5190ff83de40284bb858581bb0ec4a6.1619621413.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 and avoid memory leaks. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n"); -- 2.30.2 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 36742C433ED for ; Wed, 28 Apr 2021 14:56:34 +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 D152B6103E for ; Wed, 28 Apr 2021 14:56:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D152B6103E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=077xZdvrpMMoyZ27XKHRc6R9KVsVfrd0XHQQI3Ac7WE=; b=kmM176H9BEo2G+xDCQInYDrk6 mAIXBOOKI36ezBv6tRWtSAnOZjkzrltDBRMaQUrf4J0InPxhf0/tsEveUtgMJFZfGUgSq9nGAAcXk f0mwLrvGiVjaLCVQgy9RC6n9Xh09bU5SNFdvlnsc9JONsgWHf58FSgfh9OFBNl8xdFhGX4LaFgPp2 4CpO6bGbb047SkHcrVKGd5iLKpe0nDeGNy+gCyVjs5Sxh9Haxhst3KWn9TTcKjZHpW0qGa+PUMOpB RKOTxmN8woK7LnmB8qGLqYIg38yE0vVq1T9O7/OUFlB75WOhHSqEzr3+Ysn2IqFV134Q7y9trZBTo TqxCNAipg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblZg-003fiv-Sc; Wed, 28 Apr 2021 14:54:01 +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 1lblYX-003fQU-GU for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=UfqjQEksWt8M3LbdegcX5y2dPdTX6smEgNNd5wbgyV4=; b=2B+DH/OwGRVZmgbvSq5r5osYrW WSIo6R6IEp8Lzrf9PwTI2EX/iLZxJAp6TISY43pk0upG1rPul4aKh1e2huom+Q3wZsy2/tpopcPhf OYH84bBcdt5RZ1GPABiHD8G7OZrtuYPvbnpYj/0FI28B8JVX9brrVolIRgWU18nF4hxfLk6o6HHlw 2loCLIfI2iBBo1ekqJnut5S5zax8lH7dxt10ygTSneAWoyxDbdXvnjoDvT8+BEa74FUGLkr+6HxF8 ntGng/jEuRokwnqe98Fp/ypR5askqz34wysuh7wHJuKJ917FOiMp243qztptewojg2PTuYVYRv85P EaKNw41Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYT-00HVP5-Vq for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21675614A7; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=W1MZ5fUp2z9NMPUzLbsMjuPOyaCJXem6s4s1Qkfcwz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2TOTcw5C445poYixO6MB4771lIkivCDk6l1WcyEeoHLXx/19d6xJ7PwFCbd9A7zF nvUAN9xfF2FVM2yBWLaiNmalMlFsxj5A/UBsSSi6eDtBqBG1TUqiwtAMuwwuBPz4Wa T6MVM6CztEmBDxh1mW/Jz/Xs5VyReq83re7kSzaJaSFdmsHDnc89Y8hn9PjRx1ehzZ OFEAxVTSyd6mB4N7MKW6xKmWnVg/yWiU0CN6VtsO3ruHXAhRALU0U9raQ1OvIeylA6 0nG8cb9T4w9p+CmQzNnwUlsyp9YqwWAVvIbjdlCaN70KmHaX5tX8q8E6rdVLzQeGTA +JpqFWntku3vg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001DqV-3i; Wed, 28 Apr 2021 16:52:42 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Mauro Carvalho Chehab , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v4 19/79] media: sunxi: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51:40 +0200 Message-Id: <17cf60c9e5190ff83de40284bb858581bb0ec4a6.1619621413.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210428_075246_112828_7B746BCE X-CRM114-Status: GOOD ( 12.52 ) 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 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 and avoid memory leaks. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n"); -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel