From patchwork Tue Apr 27 10:12:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12225999 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,URIBL_BLOCKED,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 C5A28C433B4 for ; Tue, 27 Apr 2021 10:18:24 +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 6BEC36100B for ; Tue, 27 Apr 2021 10:18:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BEC36100B 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=BSu2ZoRKfaQ+ExCCAzAm6Xnud akvNbKqcZ4vglOGQ2PiTFI973JVqb0zBiF7YfINwrtldmzaP8P5wTaRgdRfU3DDeoRVgoxhPYHBRz laU4kpFetZdKKOdAm7EbwqFYBt3zP58BLiuopaiEvdAu5M+C6kqnUUn3S1qF09C7oQ4b9t5J/8Sis 6G7uQJ/zSsWnTG1G8RpQiulu6eBCDHcQcmHiX4c3wPnCAxcbXI0gj0HQwB41PL8NO72zKHySWQ1zp jS1DhzpugfTYWpCT79tehLOBy0Agnbn66hj88cXqtYu8iiRd1HPVV+d2xxF5TVgYYebSms3pKFYQC SXRAy52kg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKlH-001Jke-5o; Tue, 27 Apr 2021 10:16:12 +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 1lbKjA-001JC0-9S for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:14:00 +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=oDH5wxod7AwgdzxvqaD04WYQox lvlwTnh6b5K7mwvn6AZSXdtzXkFxaH+jKtxCu3EYjKF8PuajXkg/pC62lM8VUk5FU7XSakVMbh+2/ bgNprueZx6CUqdntbU7Ep6qCSXuiltfQGlqe2Kzlhje/obP1SCxhCWRLiX0F8k7YKtiygnCetLSWx f0BZkSVX763eWOUmu/6EOf5UpncHyyIP8uNrOxldhQTdeQZs72q4gCV4+Sg3KuFm6kO/TSFpCGsyX oFu9Q0RNkURsRTbkYZANo7LjtEofo1l9XRyfaiWz8f+hO0EjoMVwXyVzIUWBGNDWLSR0XHnGihyWs xHJycAJQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj5-00GbpR-Om for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C7F0613DD; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=W1MZ5fUp2z9NMPUzLbsMjuPOyaCJXem6s4s1Qkfcwz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hl/iigHU0Oesf/zRgLXJO++yUuqv4vZAop3JusfzFYwsnudK1Vk+a+6STjFmKVJ5K a90uNH8biqOVfPM0kvWAOBbHAmIn0mMUy8D21LXMu+GjGo0NvEbJdAALGMhihek27N fKQsNlLivJ9Dcg3sPs/svUGoUTeSF1v1wTrrWiCh6gYzSp9x9yl+RyqZXmw24tJ3mp +w6itUbrY+OKDLexMH8dmcU1OwZkSlrLiwaNrtA3SS+kNrwmKfUHx2TCJQFMThaBQK SJHqjlKP/V7frEdSh8gPHjlTrr1dGBKARpKtq4RqDwet5P2vfGoy6GTPOVA9QM7fyr MLKKSSwnemUgQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5V-Th; Tue, 27 Apr 2021 12:13:48 +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 v2 19/79] media: sun8i_rotate: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:46 +0200 Message-Id: <4e9d12ab641622cf2cd1721c257c12c52271cf05.1619518193.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-20210427_031355_970795_2B96D90B X-CRM114-Status: GOOD ( 12.72 ) 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: , 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");