diff mbox series

slimbus: qcom-ngd-ctrl: Fix error handling to keep reference balanced

Message ID 20201205122245.2108188-1-zhangqilong3@huawei.com (mailing list archive)
State New, archived
Headers show
Series slimbus: qcom-ngd-ctrl: Fix error handling to keep reference balanced | expand

Commit Message

Zhang Qilong Dec. 5, 2020, 12:22 p.m. UTC
In the error branch, we should call pm_runtime_put_noidle and
pm_runtime_disable to decrease usage counter and increase the
power disable depth to avoid reference leaks.

Fixes: 917809e2280bb ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
 drivers/slimbus/qcom-ngd-ctrl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index c054e83ab636..a9b4a1d95045 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1483,7 +1483,7 @@  static int qcom_slim_ngd_probe(struct platform_device *pdev)
 	ret = qcom_slim_ngd_qmi_svc_event_init(ctrl);
 	if (ret) {
 		dev_err(&pdev->dev, "QMI service registration failed:%d", ret);
-		return ret;
+		goto pm_err;
 	INIT_WORK(&ctrl->m_work, qcom_slim_ngd_master_worker);
@@ -1500,6 +1500,9 @@  static int qcom_slim_ngd_probe(struct platform_device *pdev)
 	if (ctrl->mwq)
+	pm_runtime_put_noidle(dev);
+	pm_runtime_disable(dev);
 	return ret;