From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFAA972 for ; Sun, 4 Jul 2021 23:06:32 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id E81A4613F1; Sun, 4 Jul 2021 23:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439992; bh=VvBNWVfKMUPM1hXDvZqcj89kC+byaY2wtn0l6MzVFvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NrRFKkUMYfJ7niNI3k/BIGn5No6wKQaqX6lpCAIoVEcBcQUtoZmr3hlC4BzOMOeJo evVY0CzLjbYcPAzOpa3fPiWpYvff4gAaBsFr8LquUFBsZGQy7zlvF6LrHbAD32Znyj 6kuSjJ1/Re+JjAPUvbXMedz/CKVl3958PwMLdQAV5jYHHvCKQHaFPz742fVW5k75CV KcjC/4r0kA1TjvhIBSZUyAbqo0W8JtkWS4ZNDWc8s5mYR0Ma0HHiDRAIqFCbLq5cBz 6J1w/5iR/2Sln8h/r9wNOjd/YGmyNZ3Xzj0CKI030xyeiqQsCaW4xhQ0+cd0oMVGKg zytRx9x0OGQOw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Jonathan Cameron , Sasha Levin , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH AUTOSEL 5.12 12/80] media: sunxi: fix pm_runtime_get_sync() usage count Date: Sun, 4 Jul 2021 19:05:08 -0400 Message-Id: <20210704230616.1489200-12-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> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Mauro Carvalho Chehab [ Upstream commit 9c298f82d8392f799a0595f50076afa1d91e9092 ] 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. Reviewed-by: Jonathan Cameron Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n"); -- 2.30.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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=-18.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 0EBD6C07E95 for ; Sun, 4 Jul 2021 23:25:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF7CA613B2 for ; Sun, 4 Jul 2021 23:25:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF7CA613B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OKqof1BqlW8Q3SB9Bv1ZbFNa/OJ6z/EZc6Z8oiBOs0M=; b=nIhxGz+EfAM63G Dx+8OhE/W6p+6aNpwsECDDRycRQa6+Luv0J/xjOhJHYQ+vJCPu4F2/1TbFLrtScHlU4M6oeiyGfN1 uERz6RAhBEVw0ydmaONz5lJzXMzL31MU9X2BcrQGwe6sAfIVXlNFmF3hHgCpHT09TPrsFa4Tu5abM e9sq2/tzP6hy25BSlIgIv5y8fKM6/zmGLCeNXiW7UnuWxRk4vOcFQBF/HM8E20XOm2EaznEEJz+4N H7oe3aGqin1MKFmlqzcTT2WePV0GNbdOLQ27Hhq74JbmdsmstFzswTTkMl9QsuROGDxdVkUHUE51X l5mV1zC5keRA7LaMWKSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0BT6-0073zw-Rk; Sun, 04 Jul 2021 23:24:09 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0BC4-006tgv-R5 for linux-arm-kernel@lists.infradead.org; Sun, 04 Jul 2021 23:06:34 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E81A4613F1; Sun, 4 Jul 2021 23:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439992; bh=VvBNWVfKMUPM1hXDvZqcj89kC+byaY2wtn0l6MzVFvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NrRFKkUMYfJ7niNI3k/BIGn5No6wKQaqX6lpCAIoVEcBcQUtoZmr3hlC4BzOMOeJo evVY0CzLjbYcPAzOpa3fPiWpYvff4gAaBsFr8LquUFBsZGQy7zlvF6LrHbAD32Znyj 6kuSjJ1/Re+JjAPUvbXMedz/CKVl3958PwMLdQAV5jYHHvCKQHaFPz742fVW5k75CV KcjC/4r0kA1TjvhIBSZUyAbqo0W8JtkWS4ZNDWc8s5mYR0Ma0HHiDRAIqFCbLq5cBz 6J1w/5iR/2Sln8h/r9wNOjd/YGmyNZ3Xzj0CKI030xyeiqQsCaW4xhQ0+cd0oMVGKg zytRx9x0OGQOw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mauro Carvalho Chehab , Jonathan Cameron , Sasha Levin , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH AUTOSEL 5.12 12/80] media: sunxi: fix pm_runtime_get_sync() usage count Date: Sun, 4 Jul 2021 19:05:08 -0400 Message-Id: <20210704230616.1489200-12-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210704_160632_905995_429C84A4 X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Mauro Carvalho Chehab [ Upstream commit 9c298f82d8392f799a0595f50076afa1d91e9092 ] 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. Reviewed-by: Jonathan Cameron Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n"); -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel