Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3343605pxv; Sun, 4 Jul 2021 16:05:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw02ifhCoN+bzFi+DWIbOEoO+1/bgHsVmzQUR3q5aurMnNrNR9RMHWGApivxFwV+eGfNZXU X-Received: by 2002:a02:1d86:: with SMTP id 128mr9592544jaj.106.1625439945524; Sun, 04 Jul 2021 16:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625439945; cv=none; d=google.com; s=arc-20160816; b=OFYQv5qbn5qlozy8BTtiUZLkNQYUMVd4BHsTRRMb4A1fUAV7qoTLmjhdoNgbiuYRVr ZA6//gz9E9dALM3NqBlLfOTFyeREgn/pmkAtKxDzseerLHDpT1SD5ISTS6WQEnV6Yg1D k2f4XrYas4rEt5RucSSTXIvfKRli1/zziH/1B9YrpCeT6xmR0Xcs+bv5i7xiiHUHcL6E ENKTJ3eXBsyOX390ie5QFmKSp6lwsMoVMq+EkqBGyQPhKrVm5WDLB/6R+Hi4WqlPXr/0 a0QPiwT7uuuS5cv1GmHwNzEF4wxZ/m3rtrvsp5Z4XYBMJ/nEYWirrCz0G9tvoTO6FhG9 Z8aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0Yq8oqHNJOapFsjK/3IDX1R5a7PzQ3Df0thFhtHC9oc=; b=kZVwHNGQq/UBFoUjTwVwtlnr5NUPP229fzOhWaCdJIZyn7yQJFSn0MifmTVE3cU/l/ 0xzaxMBGJarPsQGMDBLvw0Dxlwg4mUfUnzVqoj9gOg61vMBoXVDh4nQEchWisTrpHRX3 9T8ci01fYf93yuF3iXOgTLAnbshkmd8AedrBiF/QHYbbQOz/DoGDoVOiNsfRUrOIDekD l0PLmFKhtvodLKX+BV4QEADmLd9QU61zybytk0lJ5GoAx/3jIGadDhjV8Ug29Uxxpa1U BniPcr3lWs2ZgY5JAQFN7byln4sYnV1fQ+6p3EG7DGgbyKkYie/wM7I2wfANfMbLZKrQ j0Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qPO4NVTZ; 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 y17si5849594iod.32.2021.07.04.16.05.33; Sun, 04 Jul 2021 16:05:45 -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=pass header.i=@kernel.org header.s=k20201202 header.b=qPO4NVTZ; 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 S230159AbhGDXHZ (ORCPT + 99 others); Sun, 4 Jul 2021 19:07:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:45358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbhGDXHR (ORCPT ); Sun, 4 Jul 2021 19:07:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AEE47613E9; Sun, 4 Jul 2021 23:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439881; bh=ju547HHSoJneoZh4O62JWafGwz9NI9kYJ8MtTLOeHjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPO4NVTZMoPNA3XQKtHSaXEJrnvcPhP0MB5r+HKlVuEWJzKTRJePxVX+nFyzmDghV 7h3seivDnBvw7Y7ygagJdHiO+WziPVC7HlGDu+dC1rQgEKknCM7ZvkYcuBV37f8SFu Ps6zNY7F/FjRACvD7xuTivvnrdE5cA2zjlpXX3mI3AliyhSbzIAYsys7D4T12crsK2 D8TPaZ59YkFEun2Sgn/C+hZyHnOH473kOvqmgwpbbHRfgNz0VEzRjcur7T0BdqP9V9 SpiDxroectHGC2NpL9PWtQbqAgXNiNg6XuPqTI677zDVBjJIlpqi0Kd6lJ6pCuyrKG iwMMXaKh5x45A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Jonathan Cameron , Sylwester Nawrocki , Sasha Levin , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 15/85] media: exynos-gsc: fix pm_runtime_get_sync() usage count Date: Sun, 4 Jul 2021 19:03:10 -0400 Message-Id: <20210704230420.1488358-15-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab [ Upstream commit 59087b66ea6730c130c57d23bd9fd139b78c1ba5 ] 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, avoiding a potential PM usage counter leak. As a bonus, as pm_runtime_get_sync() always return 0 on success, the logic can be simplified. Reviewed-by: Jonathan Cameron Reviewed-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 27a3c92c73bc..f1cf847d1cc2 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -56,10 +56,8 @@ static void __gsc_m2m_job_abort(struct gsc_ctx *ctx) static int gsc_m2m_start_streaming(struct vb2_queue *q, unsigned int count) { struct gsc_ctx *ctx = q->drv_priv; - int ret; - ret = pm_runtime_get_sync(&ctx->gsc_dev->pdev->dev); - return ret > 0 ? 0 : ret; + return pm_runtime_resume_and_get(&ctx->gsc_dev->pdev->dev); } static void __gsc_m2m_cleanup_queue(struct gsc_ctx *ctx) -- 2.30.2