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 9A467C433ED for ; Sat, 24 Apr 2021 06:48:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B6956144D for ; Sat, 24 Apr 2021 06:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244132AbhDXGtE (ORCPT ); Sat, 24 Apr 2021 02:49:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:36058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233077AbhDXGqN (ORCPT ); Sat, 24 Apr 2021 02:46:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4908861621; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=HPXSSHVNkadxpReM7bF5CuY3s1w7BYlO9tOtwx586ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uU/J4RVwTdifXUXHaWtAFQnuBjrZsl2Tze9MFfsxMVFh8KugwkvcLGaJqH9CeN7lQ DYbqKgfIqc8fPzWqecO47Zudi2mkwPaGLSUXxAgHNenVZT5/olSkrTeoqvG4TLYHx9 HBarVv+6R/lacN5IT+7O9rCGBVw/fv/jcSjXIs4Pc4rrU/9FkW7Z3mem7I3uD5JFBO DW5v6Z8HerHHlWbXREGMuPIbVIyWu4ThStFcAxHe5ULgz0QqdEp8Y82S5+Po2DAA04 9OYqIDtHwaK2RydimZaH9LVfvkbUXcx5d4AqQER52UtnQnMEAGiiKXvLyV67XpIo35 cpeGyfHPBaLeA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jej-Fu; Sat, 24 Apr 2021 08:45:31 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrzej Pietrasiewicz , Jacek Anaszewski , Mauro Carvalho Chehab , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 21/78] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:31 +0200 Message-Id: <01560ba01a8e6ecb0e2e525e9b47a544c04f735c.1619191723.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/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 026111505f5a..c4f19418a460 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2568,7 +2568,7 @@ static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count) struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(q); int ret; - ret = pm_runtime_get_sync(ctx->jpeg->dev); + ret = pm_runtime_resume_and_get(ctx->jpeg->dev); return ret > 0 ? 0 : ret; } -- 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.0 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 D46AEC433ED for ; Sat, 24 Apr 2021 07:07:26 +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 9B05D6146D for ; Sat, 24 Apr 2021 07:07:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B05D6146D 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=TJujEY5idVpI7JIYiv3U81SYdvzGHazOyT3rHPLbm5o=; b=D8QmKIzuy5csX/1gJCUH6V8xR IuhW1kSbns7Xu6uKcSfsmJjfCQDwTazlrHQRLRfOeDMjO3DOctQP/xWgoAhBe+NZBKJtqWzEpmapg V7v2SLuhzWysixBCs4hVIjlzpMD1br/UUYOxPJYhL0kdj1lLars9ombADlNqUTOaSv5fw2G0g5rVn fx6ykoqZzxgoctWXsixk12IoFWgP5CTQxKC1jsQ4P7N/2rD0YqOZBJHXet8fEDF6X9pIkp341L24W fgRzibG7rZYpLNeZ2m3NWgCBEdNz1ey1/CweLUZkBsWJ3bZYx1N54+8z92Piqa7AcbSsIkDzgcrAL EjtJBnzhg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCIc-003DAk-Ta; Sat, 24 Apr 2021 07:01:55 +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 1laC5G-003B19-LP for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:48:09 +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=mKZtD7iO8l3mDyMGW/FhxvGp8k0Sp9C0Y/ioUgmVGo4=; b=ATICISDMLyAQnhS0cedH43WV1z Bgg1DrjnlwGKRKFDFjnAc8Bp4cZxZm0QFid7nvD9kPgDVynw3l55PFLapAbpL78Rfh/DWjDZO+3iQ KO7FUkiLWX9HkbQS7RfwRQcywx0c1s4renJrvCzk+nOPAbnEmfST7HtBZJ98pVPA4xNxuZR5ZvWdg dRt75zRTY4e1nTon3i//jjXj+Bp7AkChfbZQ/yowV7/wx0RsiHCzoVRYtxDc9oZ+9G0ecL3QWOXOb qqofvRARMy72KCpPVe21s8UiAV743tf4a9uSDH6mUeLoILaAppzO5UMIpfef3q8KgU340BnRCxC0s 2MFvk1yA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2s-00EsNL-2M for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4908861621; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=HPXSSHVNkadxpReM7bF5CuY3s1w7BYlO9tOtwx586ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uU/J4RVwTdifXUXHaWtAFQnuBjrZsl2Tze9MFfsxMVFh8KugwkvcLGaJqH9CeN7lQ DYbqKgfIqc8fPzWqecO47Zudi2mkwPaGLSUXxAgHNenVZT5/olSkrTeoqvG4TLYHx9 HBarVv+6R/lacN5IT+7O9rCGBVw/fv/jcSjXIs4Pc4rrU/9FkW7Z3mem7I3uD5JFBO DW5v6Z8HerHHlWbXREGMuPIbVIyWu4ThStFcAxHe5ULgz0QqdEp8Y82S5+Po2DAA04 9OYqIDtHwaK2RydimZaH9LVfvkbUXcx5d4AqQER52UtnQnMEAGiiKXvLyV67XpIo35 cpeGyfHPBaLeA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jej-Fu; Sat, 24 Apr 2021 08:45:31 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrzej Pietrasiewicz , Jacek Anaszewski , Mauro Carvalho Chehab , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 21/78] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:31 +0200 Message-Id: <01560ba01a8e6ecb0e2e525e9b47a544c04f735c.1619191723.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-20210423_234538_217193_586204DC X-CRM114-Status: GOOD ( 10.54 ) 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/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 026111505f5a..c4f19418a460 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2568,7 +2568,7 @@ static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count) struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(q); int ret; - ret = pm_runtime_get_sync(ctx->jpeg->dev); + ret = pm_runtime_resume_and_get(ctx->jpeg->dev); return ret > 0 ? 0 : ret; } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel