Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp671073pxy; Wed, 28 Apr 2021 11:41:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH+XiPVCX8NpioUiyELzdoPMdv8EUjaPTMlTplfMbC4GvE3EPrX/zSY3VIJ2HT2ppuYOwU X-Received: by 2002:a17:90a:8809:: with SMTP id s9mr5559629pjn.174.1619635319333; Wed, 28 Apr 2021 11:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619635319; cv=none; d=google.com; s=arc-20160816; b=HWgnedPWYxdQ0d4kHXOAcY418fyCaNRxdc5IbSGKQqn6xgcxoMRa0JAaCOcNXF0Op9 1bSn6zCSm3whqP1gsSgSieeUqfMllBw2LML254Oz93V1KEoUaStDDUL+aKzuS5xFVpgP K+hJcz0SsklsccuGB6KVqMS9znz6Ayt+Pv5kNShodJHaX6mBKc8WOxsMaLSWH903ByGo /RSWifmCOBCkOi5kItw3dIjkZr0ADfN0jrHppcWOO3IoeIIXXMsLSqMSbHmcH0s31EWm 0aSWlcXd2bAqwrsPeSUGk9E0NixaAaLT6tGQz9Vqm95qvxLEAW7MrhJ5E8CO8+4yCEHA 5YaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=uvxTCk9qFVRZeWu4OWV5nbuso6Js4+D7jvAIh37TJlk=; b=ZVcUb2BgWcG6guhabPwUokZmliPAG1tH7ct/ITVR3FsZJ5aAPS/NZCeb3tVh3q3uCQ V0g7LZNmLX9zPMC0tJOmKPKE7f73ZiHod4VxDwo/sr/hrAmNeOLjHqWg7LlHBwH8F3pj SYgUFVdPbVullSbyNirCNCq00u2VeLamSEhrAvFYLMqiOgxYNy5RU65moa822f2YIg82 pb3Oiwng3g9vl9Sf9XhhS0l1S3mkVXhUD0OMxUkBEa1WfgwgtuzGxCthk+KQHfMG+gz2 HUFTDF0kk4TFU/BhYQVTGLcknQoHafnqDs3PLgzjdid/3nLFPT9nGoDkn9IYWi5BeoiF iwtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=kCX5EGCo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si507785pga.98.2021.04.28.11.41.46; Wed, 28 Apr 2021 11:41:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=kCX5EGCo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240626AbhD1OzN (ORCPT + 99 others); Wed, 28 Apr 2021 10:55:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:36302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240304AbhD1Oxe (ORCPT ); Wed, 28 Apr 2021 10:53:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22A4F61554; 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=dO1gD2vCTyNaQMmr4CD5RrufRsq5HOpPc9z13n0Rohk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kCX5EGCo/+tl8FiqD+iNAbou4vWiupP08Ja8L3uTC65gi9JfE/CQToRBSiYRBXdk0 Yw2U+kLbsDYq/XQzgAkCxFm72cVF/5JmFhTv1h4X1tfjAV/hScgHc2YCPzGWFCeGfQ JIT+/ymvxUOJ2xHTBMTy1xo8ACpTLPdnt0UYsDie+L4PRYifDpexKYGHf+2BrTWP+j 3D47LMx6DT+8/l1DAYIjaWS8yV8QCKuXDo8vOibUBAyxBLTQ2oj6O/I64F6hSHNC5p ATCeTtSBNZo1zWs8rhdRgNsPwd7kiww9HFQS0W26E1NYNcGyjxuzjG2yeBylpJ3vC8 XL4KE9+6Np9Kg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001DqM-0u; Wed, 28 Apr 2021 16:52:42 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Tiffany Lin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 16/79] media: mtk-vcodec: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51:37 +0200 Message-Id: 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/mtk-vcodec/mtk_vcodec_dec_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c index ddee7046ce42..fe096fe61c9d 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c @@ -92,9 +92,9 @@ void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) { int ret; - ret = pm_runtime_get_sync(pm->dev); + ret = pm_runtime_resume_and_get(pm->dev); if (ret) - mtk_v4l2_err("pm_runtime_get_sync fail %d", ret); + mtk_v4l2_err("pm_runtime_resume_and_get fail %d", ret); } void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm) -- 2.30.2