Message ID | f77d93e5129ea5663d7ebb1de12cc42abd7dc893.1619518193.git.mchehab+huawei@kernel.org |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-media-owner@kernel.org> 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 3330BC433B4 for <linux-media@archiver.kernel.org>; Tue, 27 Apr 2021 10:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E84A60FF1 for <linux-media@archiver.kernel.org>; Tue, 27 Apr 2021 10:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235638AbhD0KOy (ORCPT <rfc822; linux-media@archiver.kernel.org>); Tue, 27 Apr 2021 06:14:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:34862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235369AbhD0KOf (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AC42613D7; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=ozAIBQhBgl4hYvo20eM4TXq01azS0FPBmDKGIed3VZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuwsfLYcUi38xmu83GyBHZLxUohbg1NqqupeRKfqB3+/nM99vKRGZZezvrhVoh8iI e4CcnC4riQ1gOlnXfX+xChGqaPaNwQfEef+9eDfMnvHnctwkFhTXh5JM6PIHY/ld4F WHayV2J9qR4bhDdtkw55iYIdOrdIfg+xH7/nUGVIZxfz0duBTGvXDjCp2l06oH7F/n ctA5RGU3WEANvjfiqvO+czngubNbQVPMn0iMG7FIjvVxyqb28XgXnJLIQJzWRVZXeM 7kLdNabtcr51VayI4eqV8Qsqo6AC/f/CUrxYKjsZ9HUIZDS0uqrVUI2dhh5UsvSqu2 zmJijurrDoDFA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from <mchehab@kernel.org>) id 1lbKiy-000j5D-NB; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Marek Szyprowski <m.szyprowski@samsung.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 13/79] media: s5p: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:40 +0200 Message-Id: <f77d93e5129ea5663d7ebb1de12cc42abd7dc893.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <cover.1619518193.git.mchehab+huawei@kernel.org> References: <cover.1619518193.git.mchehab+huawei@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab <mchehab@kernel.org> To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/media/cec/platform/s5p/s5p_cec.c b/drivers/media/cec/platform/s5p/s5p_cec.c index 2a3e7ffefe0a..2250c1cbc64e 100644 --- a/drivers/media/cec/platform/s5p/s5p_cec.c +++ b/drivers/media/cec/platform/s5p/s5p_cec.c @@ -35,10 +35,13 @@ MODULE_PARM_DESC(debug, "debug level (0-2)"); static int s5p_cec_adap_enable(struct cec_adapter *adap, bool enable) { + int ret; struct s5p_cec_dev *cec = cec_get_drvdata(adap); if (enable) { - pm_runtime_get_sync(cec->dev); + ret = pm_runtime_resume_and_get(cec->dev); + if (ret < 0) + return ret; s5p_cec_reset(cec);
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. While here, check if the PM runtime error was caught at s5p_cec_adap_enable(). Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> --- drivers/media/cec/platform/s5p/s5p_cec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)