From patchwork Tue Jul 18 13:28:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13317229 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 8407DC04A6A for ; Tue, 18 Jul 2023 13:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232638AbjGRNaB (ORCPT ); Tue, 18 Jul 2023 09:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232753AbjGRN3z (ORCPT ); Tue, 18 Jul 2023 09:29:55 -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 7C227124; Tue, 18 Jul 2023 06:29:48 -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 5BDAC6158D; Tue, 18 Jul 2023 13:29:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ACDCC433BA; 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=YujBf+tSBimSZNEfZhDQx4wRVWWIF1I4fAuUh7MYhGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmIIeasD+VaC2Xfn+NQv1hEgjLN+EocrpSUkbost1LU6y29N7ZAZig7/5AukCFMkA RXcIis9R8tIbzePesSTgpwH039Mk7WAoW7hL7ZWg/N26/tDkP/oIQMHHQ4I88Zje21 NrkuxsG8wplGmK06mjd1s0+C3WyrkEiQOVE9iFWcGABjL8Kao/mxfczHs562zcPc0v WH8kXwXFEBisOl//Rch6Ht83H9lIRJdmd8c3soTyHRJPOzheqPtIRl0+9EAqXnAxui kH1qbwb5SeWqxGTG+MJCzUQQYfjFDHowtyPaOJ5f7621J23QjI9GuWsKlRy3Vb2uMg 1DcMSarGXWHgw== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qLkm2-0005c5-06; Tue, 18 Jul 2023 15:29:54 +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 Subject: [PATCH 4/8] clk: qcom: gcc-sc8280xp: fix runtime PM imbalance on probe errors Date: Tue, 18 Jul 2023 15:28:58 +0200 Message-ID: <20230718132902.21430-5-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 RCG dynamic frequency switch initialisation fails. Fixes: 2a541abd9837 ("clk: qcom: gcc-sc8280xp: Add runtime PM") Cc: Konrad Dybcio Signed-off-by: Johan Hovold --- drivers/clk/qcom/gcc-sc8280xp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c index 1fb6ffac730c..ac6f8c0c1ccb 100644 --- a/drivers/clk/qcom/gcc-sc8280xp.c +++ b/drivers/clk/qcom/gcc-sc8280xp.c @@ -7539,8 +7539,8 @@ static int gcc_sc8280xp_probe(struct platform_device *pdev) regmap = qcom_cc_map(pdev, &gcc_sc8280xp_desc); if (IS_ERR(regmap)) { - pm_runtime_put(&pdev->dev); - return PTR_ERR(regmap); + ret = PTR_ERR(regmap); + goto err_put_rpm; } /* @@ -7561,11 +7561,19 @@ static int gcc_sc8280xp_probe(struct platform_device *pdev) ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, ARRAY_SIZE(gcc_dfs_clocks)); if (ret) - return ret; + goto err_put_rpm; ret = qcom_cc_really_probe(pdev, &gcc_sc8280xp_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; }