Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3345856pxv; Sun, 4 Jul 2021 16:09:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0RaQ7s+NKWKSzorv22a8dKfibKwv2wHbb/bK3dsdGlwouDm7rBu5LfsMGB+GqVeOi3T60 X-Received: by 2002:a92:c6ce:: with SMTP id v14mr8708720ilm.12.1625440199332; Sun, 04 Jul 2021 16:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440199; cv=none; d=google.com; s=arc-20160816; b=kNoSfbhSSlLh/De6lYOgALBSzmBZpIGQhEeQI49yMc1DUNqeVFn79TNyaHr0Y3W24M roptzaU7WlPVgFjhPM451jbzai1MaPrk+opWyZWYlqd5MK7ntl1GKcKsQWUguJL8FXPL tZolWLDCqfXBlpU3BxIKyijY/T1DalrXpeXoaUaXO61K6NJyElaNrk6QH440OUNH4Pxy sDLo22HWr361ByUJWi4J01D5IfsY6MDusUlWyBq42qYwqyIBS4KagPsaPVRPyTpoe10U lhIml+cSo3jUHlfkVc0iKl+oTeQl/ZZSOa6jy+Q0UKdIXeHzsCo6CWt2Zveo4q5ktGdi 54vQ== 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=L7gZNxNGBhXlzj0r0N2zL6i9MF2/FrBtXxYJz0t1AQKa1m8nu0fYnud+N1mcmGbkWy mpeOPnaSdwGOD3wMbxGVkNia8DOa3teoTRaURV9B7hznqp1P5hNE1/+cdGjjlmVxIUfj UP1cHRrqI/Oq7XdYUO/rFyytraJ80O9B1DbAP9niNbXgt0aIH5ipZ7aO4DkJpNXzUphS TA3u4az8Y7qhdX3rq36XDlnAJt0JtbarAvyy4Pdw8cLXjCRSbStypK5jPFmML7RfZPNd gsdEpufqe1Jr43+NcBC3Ism9uKP2OzTNAR/BjtEG3ijUGYhGDOWj8hlUeYnPnXGzfRGK hiqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SyTphcY8; 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 c6si13360425jab.33.2021.07.04.16.09.47; Sun, 04 Jul 2021 16:09: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=pass header.i=@kernel.org header.s=k20201202 header.b=SyTphcY8; 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 S232477AbhGDXKf (ORCPT + 99 others); Sun, 4 Jul 2021 19:10:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:48260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbhGDXJI (ORCPT ); Sun, 4 Jul 2021 19:09:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 872FF613F3; Sun, 4 Jul 2021 23:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439991; bh=hSjnugpCRJfdhSCYyqirPRHugjApYrssbPiR6eQSbaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SyTphcY8UlBiYH7DJcF01DfWKLlj6Etaikx4Vy+Q9kjZiMjyiqiKnL2AeMnwu+lVI CWNHToZNXuJkVYaSKY1Bk0k2EAaeLy+66ew1CCScWE4PEDrwCOtfyghAxIbcSOwNdY eq86an74LmUVTk8UgnHHAvvpZdMyZbGE+5dan1d2CKJEnK87V/7LweM5jyK8Y2sCjV VOFLjkP8NDdHn9/XYLixqZfo9FUgQrUX/EIXT3r7FxkqpBOrlc4sv1sDfRKBnj/V7O 46+oyvJtr5SkNWFEjyR/ZnxAw+MxCD3WalxeV5HPKL9R8o0/i8UWviZMsGQYXv5hoj NrrNojG37qYrg== 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.12 11/80] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Sun, 4 Jul 2021 19:05:07 -0400 Message-Id: <20210704230616.1489200-11-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230616.1489200-1-sashal@kernel.org> References: <20210704230616.1489200-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