From patchwork Tue Oct 27 13:50:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 306937 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 D4791C63699 for ; Tue, 27 Oct 2020 18:11:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C6FE2076D for ; Tue, 27 Oct 2020 18:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603822300; bh=nzyNKnlvQUFwa97D46h/9JH6DNevRH/OniOTgNqcPjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VVKr/cie+p07Egg6h92Jf2rJUqmYXPSNleFIdnjaoHj2SpiCmRv63dmdYghDz7MjS 5NanA7nkCM0Knaf/MPJr0JUtkylyqGZ0MgrUwjgRI2pxTd6xKQF9vfGtSynldLpzYk cZBJFLrm2RndLZHYCupOd6a1bNFzGijci2mJeX4c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1825592AbgJ0SLh (ORCPT ); Tue, 27 Oct 2020 14:11:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:36454 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756815AbgJ0OOv (ORCPT ); Tue, 27 Oct 2020 10:14:51 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B08212072D; Tue, 27 Oct 2020 14:14:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808089; bh=nzyNKnlvQUFwa97D46h/9JH6DNevRH/OniOTgNqcPjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqvNg/xdpPfB9qGrBrVLiQtuXDlpo/h643muQRidqp7JKRTKq/rjTN/pM/lJI4o80 7E+zIIBYE4qkEtZa0YunqflYGbUPLjpWODPj/bW8LOQWah5f1RoQkHsJxG4m05aPVs 3K0qpwT4XP5N80QvX7XbSKH9Y2HUs3tFRmZPOSBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 153/191] media: venus: core: Fix runtime PM imbalance in venus_probe Date: Tue, 27 Oct 2020 14:50:08 +0100 Message-Id: <20201027134917.062721687@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit bbe516e976fce538db96bd2b7287df942faa14a3 ] pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. For other error paths after this call, things are the same. Fix this by adding pm_runtime_put_noidle() after 'err_runtime_disable' label. But in this case, the error path after pm_runtime_put_sync() will decrease PM usage counter twice. Thus add an extra pm_runtime_get_noresume() in this path to balance PM counter. Signed-off-by: Dinghao Liu Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 9360b36b82cd8..0a011b117a6db 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -236,8 +236,10 @@ static int venus_probe(struct platform_device *pdev) goto err_dev_unregister; ret = pm_runtime_put_sync(dev); - if (ret) + if (ret) { + pm_runtime_get_noresume(dev); goto err_dev_unregister; + } return 0; @@ -248,6 +250,7 @@ static int venus_probe(struct platform_device *pdev) err_venus_shutdown: venus_shutdown(dev); err_runtime_disable: + pm_runtime_put_noidle(dev); pm_runtime_set_suspended(dev); pm_runtime_disable(dev); hfi_destroy(core);