From: Zhang Qilong <zhangqilong3@huawei.com>
Date: Tue, 8 Nov 2022 08:03:21 +0000 (+0800)
Subject: soc: ti: knav_qmss_queue: Fix PM disable depth imbalance in knav_queue_probe
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6eca7a2535eb434bcfee3963821e8f0f163714e3;p=linux.git

soc: ti: knav_qmss_queue: Fix PM disable depth imbalance in knav_queue_probe

[ Upstream commit e961c0f19450fd4a26bd043dd2979990bf12caf6 ]

The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context.

Fixes: 41f93af900a2 ("soc: ti: add Keystone Navigator QMSS driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/20221108080322.52268-2-zhangqilong3@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index de11f2b8db0f8..52389859395c6 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -1787,6 +1787,7 @@ static int knav_queue_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 	ret = pm_runtime_resume_and_get(&pdev->dev);
 	if (ret < 0) {
+		pm_runtime_disable(&pdev->dev);
 		dev_err(dev, "Failed to enable QMSS\n");
 		return ret;
 	}