From patchwork Thu Sep 14 20:31:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 140713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1336294vqi; Fri, 15 Sep 2023 14:44:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHrqolkA7jNmE2afd6B6NKw3CMprN4jB7C/ICa2rRs3ZXay/69yXeIRfhF90AW+42pGkdhu X-Received: by 2002:a05:6358:430c:b0:129:d242:f782 with SMTP id r12-20020a056358430c00b00129d242f782mr3710126rwc.0.1694814259746; Fri, 15 Sep 2023 14:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694814259; cv=none; d=google.com; s=arc-20160816; b=ouw1Q2yfAAs2qSQP1QwOep/ivQjIAFjEFtp9F9phE0r3+1vOKOZq9sPH8a9k/fLV8N ghunEVPcnTRNi35WZSJE23B7GcFAU+xOHG0uHhqJDEwu93Gg/M2xyh3Ga8lpb8Z2vcCv VYf3piVQ+zbItegJ7bp6cRE1Jy83DHAGfZ2uJgKpsR9ZED27U7hfDeIHLU1dNhCa+/H9 6U2wxIEXuWafGSzWfVyjjFCDvtGOJNtyecm+EQpGGXoZAIv716juiQoHvg7yWZ4n4seR jZ2wGT8VYOYWlx8YG2+7w9L6KZifU1jiH3sPylsmnAFmZ0Z+ipzylmcg+ee4LgXQogcp FurA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uJUbD44KFFzWixdbKCNvbFqaLxCfMEIUABC+xCGz+h8=; fh=uRtjX4tW/2u6hJ6MjD3hufbLT/8nXPchx+f+WmII/I4=; b=IN1jy2+VGZKXzlxeYffVYNbkQFzwK7602oizW53YTIy0c38PiWVoTNTNBCW/G0sbTc ya4Egctdti2yTBcUiwpPbHUjM0iELUM5L4kgGPmwdlZLfGsP8PP8N/GBLNMBhUfTuJnt 7Hi5rssW3wL3ClN13DB7zQCuI/9YOElNKfl+x7cFDzAO52MZWjUwx1Op2YGBui1l+qL1 blrqM3conKagi/y+4d+Z/x+HCY1fvP7CIn4L5Fyj7fNrkTcifiXyUiImUbqcwKjShLhf dtR1SjZLm0BPcGjLFmd6codV+kgUXM338MDQkbYnuvS933My+cHZhbC8piHA13b9611U 5ItQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="YsX/EaRd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id w62-20020a638241000000b00577812dd270si3746862pgd.573.2023.09.15.14.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:44:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="YsX/EaRd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id ACC068258C88; Thu, 14 Sep 2023 13:31:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229985AbjINUb2 (ORCPT + 33 others); Thu, 14 Sep 2023 16:31:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbjINUb0 (ORCPT ); Thu, 14 Sep 2023 16:31:26 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B123F2701 for ; Thu, 14 Sep 2023 13:31:21 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id gszUqMvFz7mcCgszgqSujL; Thu, 14 Sep 2023 22:31:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1694723480; bh=uJUbD44KFFzWixdbKCNvbFqaLxCfMEIUABC+xCGz+h8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YsX/EaRdLBP85K/6bBP2Aha5OcT3dD8fBN9dwo5VUfI+WskzbbHIhG5SdMV5qrLxq 4mynLaS+CwsO9EC4d2UpwkhaWR+aSXd8iH82HeTiD7GMUb5dIPEtzH4TG4qH4/WgTS LcxbGiDsJiMBiskch95I5TdB1H4uEt4+4NBzSy5kGnLDVu/PEgMtiucXDDUubaQa8k fEQJuagJOCtIHSY48dsi2OF8nqMQhlwAgteuiscn8tqM9CS//lYwicdnkc7pwd0J2z 74tonesYF6Z4mKsSv5+8Zl/MqUDRqDMEFp7MhZdgggnYj2lrClchrqNo0wMtvIYuOz P88jgwDJCB4/A== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 14 Sep 2023 22:31:20 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, shengjiu.wang@nxp.com Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH v2 3/5] clk: imx: imx8: Fix an error handling path in imx8_acm_clk_probe() Date: Thu, 14 Sep 2023 22:31:04 +0200 Message-Id: <64da5952f807f37f29f0c4420ac1bde416551a13.1694722339.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 13:31:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777141557083449702 X-GMAIL-MSGID: 1777141557083449702 If an error occurs after a successful clk_imx_acm_attach_pm_domains() call, it must be undone. Add an explicit error handling path, re-order the code and add the missing clk_imx_acm_detach_pm_domains() call. Fixes: d3a0946d7ac9 ("clk: imx: imx8: add audio clock mux driver") Reviewed-by: Peng Fan Signed-off-by: Christophe JAILLET --- drivers/clk/imx/clk-imx8-acm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/imx/clk-imx8-acm.c b/drivers/clk/imx/clk-imx8-acm.c index 73b3b5354951..1c95ae905eec 100644 --- a/drivers/clk/imx/clk-imx8-acm.c +++ b/drivers/clk/imx/clk-imx8-acm.c @@ -374,7 +374,6 @@ static int imx8_acm_clk_probe(struct platform_device *pdev) 0, NULL, NULL); if (IS_ERR(hws[sels[i].clkid])) { ret = PTR_ERR(hws[sels[i].clkid]); - pm_runtime_disable(&pdev->dev); goto err_clk_register; } } @@ -384,12 +383,16 @@ static int imx8_acm_clk_probe(struct platform_device *pdev) ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_hw_data); if (ret < 0) { dev_err(dev, "failed to register hws for ACM\n"); - pm_runtime_disable(&pdev->dev); + goto err_clk_register; } -err_clk_register: + pm_runtime_put_sync(&pdev->dev); + return 0; +err_clk_register: pm_runtime_put_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); + clk_imx_acm_detach_pm_domains(&pdev->dev, &priv->dev_pm); return ret; }