From patchwork Tue Jul 18 13:28:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 704096 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80386C04FE2 for ; Tue, 18 Jul 2023 13:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232734AbjGRN3v (ORCPT ); Tue, 18 Jul 2023 09:29:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232638AbjGRN3s (ORCPT ); Tue, 18 Jul 2023 09:29:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBF7E1A2; Tue, 18 Jul 2023 06:29:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D0C5B61585; Tue, 18 Jul 2023 13:29:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F01CC433CA; Tue, 18 Jul 2023 13:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689686984; bh=rTV/bK0bQBuIPkpnsjy5F2DIV6tuENtBUl6x1oqCHu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nmMvzP14UYokUr3JipIPArmssFV0djWEqrE+wmnfNzJrHUJEgb4HblTfpCuDHIqOF 6uV79daQlmFNWI6T1fblY2C5QiPPa0vOMPG7x9KiV4z6xHRrGW42M8BctPEfzJuNwD Xp6U4Y7uF5u+OdsLp+sh03i0MdLSrtLESC0gWhShfpSLvBStlptF42oAKkbWr/zxDC GgSXjevnj4oBJNdyyfAWJYQaaosHj12W12/rbx3xdfVKYyj4zanWuKbmnW+SkDdZ02 03VnDgh6VsjLyXUI+KjdYcgji4BqkH+8nwHcroD53EwaP0hqXgSE3jfZ3QxFjHb5Yi sUcB53jGDucMA== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qLkm1-0005c0-2l; Tue, 18 Jul 2023 15:29:53 +0200 From: Johan Hovold To: Bjorn Andersson Cc: Andy Gross , Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Dmitry Baryshkov Subject: [PATCH 2/8] clk: qcom: dispcc-sm8450: fix runtime PM imbalance on probe errors Date: Tue, 18 Jul 2023 15:28:56 +0200 Message-ID: <20230718132902.21430-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230718132902.21430-1-johan+linaro@kernel.org> References: <20230718132902.21430-1-johan+linaro@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make sure to decrement the runtime PM usage count before returning in case regmap initialisation fails. Fixes: 16fb89f92ec4 ("clk: qcom: Add support for Display Clock Controller on SM8450") Cc: stable@vger.kernel.org # 6.1 Cc: Dmitry Baryshkov Signed-off-by: Johan Hovold --- drivers/clk/qcom/dispcc-sm8450.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/dispcc-sm8450.c b/drivers/clk/qcom/dispcc-sm8450.c index adbfd30bfc96..84db4ff5485a 100644 --- a/drivers/clk/qcom/dispcc-sm8450.c +++ b/drivers/clk/qcom/dispcc-sm8450.c @@ -1776,8 +1776,10 @@ static int disp_cc_sm8450_probe(struct platform_device *pdev) return ret; regmap = qcom_cc_map(pdev, &disp_cc_sm8450_desc); - if (IS_ERR(regmap)) - return PTR_ERR(regmap); + if (IS_ERR(regmap)) { + ret = PTR_ERR(regmap); + goto err_put_rpm; + } clk_lucid_evo_pll_configure(&disp_cc_pll0, regmap, &disp_cc_pll0_config); clk_lucid_evo_pll_configure(&disp_cc_pll1, regmap, &disp_cc_pll1_config); @@ -1792,9 +1794,16 @@ static int disp_cc_sm8450_probe(struct platform_device *pdev) regmap_update_bits(regmap, 0xe05c, BIT(0), BIT(0)); ret = qcom_cc_really_probe(pdev, &disp_cc_sm8450_desc, regmap); + if (ret) + goto err_put_rpm; pm_runtime_put(&pdev->dev); + return 0; + +err_put_rpm: + pm_runtime_put_sync(&pdev->dev); + return ret; }