From patchwork Sat Dec 5 12:22:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Qilong X-Patchwork-Id: 11953395 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 8A77FC2BBD4 for ; Sat, 5 Dec 2020 18:44:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 660AF22EBF for ; Sat, 5 Dec 2020 18:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbgLESno (ORCPT ); Sat, 5 Dec 2020 13:43:44 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9117 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726003AbgLESnj (ORCPT ); Sat, 5 Dec 2020 13:43:39 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cp7sj1wgqz15JTv; Sat, 5 Dec 2020 20:19:05 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Sat, 5 Dec 2020 20:19:29 +0800 From: Zhang Qilong To: , , CC: , Subject: [PATCH] slimbus: qcom-ngd-ctrl: Fix error handling to keep reference balanced Date: Sat, 5 Dec 2020 20:22:45 +0800 Message-ID: <20201205122245.2108188-1-zhangqilong3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 --- drivers/slimbus/qcom-ngd-ctrl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) qcom_slim_ngd_qmi_svc_event_deinit(&ctrl->qmi); if (ctrl->mwq) destroy_workqueue(ctrl->mwq); +pm_err: + pm_runtime_put_noidle(dev); + pm_runtime_disable(dev); return ret; }