Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp581816pxx; Wed, 28 Oct 2020 11:38:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwk0nvp/wg5+qBdegTr3CXnF6qvSP8QbB+hNgzKeec5wGJmbVMqE975b891zGXu3WnWqpv X-Received: by 2002:a50:cd51:: with SMTP id d17mr222736edj.93.1603910312757; Wed, 28 Oct 2020 11:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603910312; cv=none; d=google.com; s=arc-20160816; b=Ocktp0TXaM0dvqraHgbo6E+8g+juC/uWcjUgk6cHbT5zWAPonDoFHCTGy+3CyQt1ko AcRNcP9b+91Y/krf34mbKHb0sixYPPCkA9VytUpSiJK9ApuZWf0aRMebXVMREnctgorn YcCH7qChRs3naTYK6X6GUUnAHSP2v7OZGmusfXsa8g36Olosz/i2bg05qX2fCqYORZBf C8Xh8zPttxVNQRUTg2fjOel6J3JbLtCdGnHHzRAmFEno0BHkvLMQ/aiJoYBs0mTduQST 0E+kqIdcoMYl9424xsCJJaDPrmOglEZC3M8X137Iud2WkMHTd9HEZxz9hYehmT23YRMo 7Gnw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BJ2YE6ixY8hlKLaVsFDZlaPRXZ+K3vgU46s0cuYMx2E=; b=XIFWuufG6AzCREhQTrnNvjBmM+zzQDwY38J/ImZBZJrJ8f+AblhKCVaoXTMyl24Ng/ /7EdfnXJdxsjRbsUhwY4Gp5uOgWZKFc6ikSouGmbgUMhL4yNjjjTw2aNv/PThD4ht52A KHKXVOxYYNd3JO6H/9g4f5Q9hfZ3Lt6TfzLf1BCOB5JafYplq+B2onUyAL5AIQkuWSCP 6Y4/nV/I/nrnwrbCVO369reNXqp9WUtQ9HnjqYVD0tJXorTjAtwc4BBVEp9xF/Rpstqf N/fGXqo4IiLIJCaAGO6pqaEgprq+QIvqboGQIibG7tKdjtMudsLLPehmCMiLI8xX38NI Jmdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="AqvNg/xd"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si6073edt.484.2020.10.28.11.38.10; Wed, 28 Oct 2020 11:38:32 -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=default header.b="AqvNg/xd"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1825628AbgJ0SMI (ORCPT + 99 others); Tue, 27 Oct 2020 14:12:08 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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); -- 2.25.1