Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3343503pxv; Sun, 4 Jul 2021 16:05:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCypKMZzIXWSVYxmrEXzDXMvVU6FfDWqQ+2CGLl2qHqE0H5Qx4OKYZUf1psYITbfBjbVV9 X-Received: by 2002:a92:c708:: with SMTP id a8mr8437512ilp.177.1625439933522; Sun, 04 Jul 2021 16:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625439933; cv=none; d=google.com; s=arc-20160816; b=cNKjhTeIUQ8+jOhkQwoXbFyySLs6YZGLFLRn8SsJ87xggkT1qbDV1BtHJ4yrsmi78u 0NeHFT2FlorF+TXQfLtEgytYIu8TiVdhIwo0/MD6XE4qLERJJRxPCzOoM1xPyBCpvLCV JTzksYcz5bjjrV44rMDMyc8SwjuU5C2UlWDIanIgct0edewcYQaK8X8KYU/ACnmlyiP+ il5HgWHXfleR7slTp/4V2YVR9RGM9qBqXVLaRyMVNOfNYBtdC3zV/unRFs5OC3pnguDU f4tkl+8U6qN/m+8RD3vOEb7mkgkyXnqE+jcvEZAT96wKwH4KSodPQ/drzDmo0uqU6Kjd 7/TA== 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=sdy1Ek1QGR6uh4F12NXXVPY8WrCNIFOtbjww2RFn/Po=; b=r+BcV/OB13LWM8ITibB5VS9DrCei2dCZmmUR5wcy4l1uYRdkaBS9ENjOiekB1P46H2 FlIQyuuGChYygNEPdcjUlyNdLeNAlkaPiLplh+fsERbWlAstzDENvFROBvG+yG1g7ulp WM5KTvH9QG9yqFFq7kqwJuF79FilNeiLkd7calr09udWzBi/Lc5CKxwmustAABZU2E7W 5BPVf+056Bp2JsZuGnGEUyGXjHebcWV1XcwxRNLa4vIbACek8EjRszDWDX7P2nAla2Lp /hp4O9fU1+ioNoGwSVLacDVMYUq+Pd+oWATGDkD9NQgPbNgJ1cbHXEFAAk8aDs+FArt+ 6k4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pw9SqdNO; 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 r14si12586071ila.121.2021.07.04.16.05.21; Sun, 04 Jul 2021 16:05:33 -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=Pw9SqdNO; 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 S230063AbhGDXHS (ORCPT + 99 others); Sun, 4 Jul 2021 19:07:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:45202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbhGDXHM (ORCPT ); Sun, 4 Jul 2021 19:07:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3F7E5613D2; Sun, 4 Jul 2021 23:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439876; bh=hSjnugpCRJfdhSCYyqirPRHugjApYrssbPiR6eQSbaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pw9SqdNOgCSpZoXHW7vcoNBRGE8NqQv5vhwfcgWM8bj46EUuBTj08DE6vMwaT6C4e A2EDUyE3d2iCVj7BDaZhjiFBBydbqe4tWJauh3XbkWdNuwCAaRlWoZmP1fws8JcuTH YNlUvXN+BZCzd84BEZNtftZCyaT+zXF/XgSe9NPxDSDoB5yI4upxQUr3uIVj3fcQLS wCRwFXwjhnAk1Zibcw+nuof76deBKo5Nu0wgwjZeO9hWIQqogvACvWkbkOEgXLL0PH a+75fy8Y2wKeZUUchoopkXNg1cSSYBEQhqyHv6QMbvJtfHJiX9yUhFbs+hsLZ62nNm cCHYSoJ8E+U2A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Jonathan Cameron , Sylwester Nawrocki , Andrzej Pietrasiewicz , Sasha Levin , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 11/85] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Sun, 4 Jul 2021 19:03:06 -0400 Message-Id: <20210704230420.1488358-11-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 10343de268d10cf07b092b8b525e12ad558ead77 ] 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 plus, pm_runtime_resume_and_get() doesn't return positive numbers, so the return code validation can be removed. Reviewed-by: Jonathan Cameron Reviewed-by: Sylwester Nawrocki Acked-by: Andrzej Pietrasiewicz Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 026111505f5a..d402e456f27d 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2566,11 +2566,8 @@ static void s5p_jpeg_buf_queue(struct vb2_buffer *vb) 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); - return ret > 0 ? 0 : ret; + return pm_runtime_resume_and_get(ctx->jpeg->dev); } static void s5p_jpeg_stop_streaming(struct vb2_queue *q) -- 2.30.2