From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795024856; b=b4IlyJpPGY5jwA8xx2b3xDhsfgZN04Nfmhvf1gRu6aCocFbWmBtb4scxZ6TCdUqN/K3/ LQwpm+34eFJXQeUB+xdCF6GMmR5awYM6e9/t2vV8cXTIyiuhNnnWeEy2rNsumxUDlqYy7 Uq1iE359TTvFtBGif2qW39jSMZ9qh5xJ72kjIW/TDBXLLw1T4UEtQYrMCDc+buxVTFkun 7Drxd6oU3THWED53IrSF+woyP4xBQ42zJ4K5inJlBbX4+q0DILyYPrbwUAS4zmPeTqI66 dXyaGmCD6ZoeuhX/L2dAK/9lmXe8L8sAILY9dW9++sSXGiiGSxCTrjmhflaXMeCPD1w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795024856; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=6OgtgMwov4BBpZ53DxRPzI2SefASAQuQ0TGJhL6OaUU=; b=Eomvj1akWaMtnmI/qxiV5ss5mLL3EsQsi7XnQiIK3hzwjMUWPQm2sw08MeQ37aHRkI6q iDXC0XgfY9zEjAB3/RaY/j5V4ifOcV+bt18SYwXSa99IKPslHq3x5m+v3SfIBT8B7GDBd Geikhq+xIGKy08f/i8nr7pwxOJH7rF9fdDHvTWSrv8V7paBOp5JghWuG0HklJvm2sPgzn oPP2RE26rm+PXF19nkR3nI7QwZrDMjENeR2zYYVhNpZpLOFLX5NfDYcZV1+e4/IiwJyjC WCr3+fAfuTbTrr186MTm/4h9XvsSjnUq7hLxYMTezmx61aiQ/umYwfu5meAXhnJ3zsA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2YBaL54f; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F174606A31C; Wed, 18 Nov 2026 18:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2YBaL54f Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E1D91F000C7; Wed, 18 Nov 2026 18:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795024856; bh=6OgtgMwov4BBpZ53DxRPzI2SefASAQuQ0TGJhL6OaUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2YBaL54flFn2neOC+rj+ztvzXWOMpLo+7tih4QcBsGoVz6vIQaKG67db5GknsQRDx JIiCYuPpQp2AMEZgH/H5cuSYqYdU26mkZT5QoIFpj21PB8VehleBkZfJUOK66DOnae hXZ8kkwj5zvFWSyR2L45XVwRsLwRRk62nZ5EQd00= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, bui duc phuc , Mark Brown , Sasha Levin Subject: [PATCH 6.18 0821/2151] ASoC: mediatek: mt8192: fix error handling in APLL enable functions Date: Wed, 18 Nov 2026 15:42:36 +0100 Message-ID: <20261118150152.039408397@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150121.603863898@linuxfoundation.org> References: <20261118150121.603863898@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: bui duc phuc [ Upstream commit 88760524ca995acd229c30ec69ced7d883a90a72 ] If a clock operation fails in mt8192_apll1_enable() or apll2_enable(), the functions return without checking the return value of mux settings or unwinding previously enabled clocks and MUX configurations. Fix this by checking the return value of apll1_mux_setting() and apll2_mux_setting(), and adding proper unwind handling on failure. Fixes: 125ab5d588b0 ("ASoC: mediatek: mt8192: add platform driver") Signed-off-by: bui duc phuc Link: https://patch.msgid.link/20260918133912.133799-4-phucduc.bui@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/mediatek/mt8192/mt8192-afe-clk.c | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-clk.c b/sound/soc/mediatek/mt8192/mt8192-afe-clk.c index 7647bdd463d9c..118dd48196828 100644 --- a/sound/soc/mediatek/mt8192/mt8192-afe-clk.c +++ b/sound/soc/mediatek/mt8192/mt8192-afe-clk.c @@ -308,20 +308,22 @@ int mt8192_apll1_enable(struct mtk_base_afe *afe) int ret; /* setting for APLL */ - apll1_mux_setting(afe, true); + ret = apll1_mux_setting(afe, true); + if (ret) + return ret; ret = clk_prepare_enable(afe_priv->clk[CLK_APLL22M]); if (ret) { dev_err(afe->dev, "%s clk_prepare_enable %s fail %d\n", __func__, aud_clks[CLK_APLL22M], ret); - goto EXIT; + goto err_disable_mux_setting; } ret = clk_prepare_enable(afe_priv->clk[CLK_APLL1_TUNER]); if (ret) { dev_err(afe->dev, "%s clk_prepare_enable %s fail %d\n", __func__, aud_clks[CLK_APLL1_TUNER], ret); - goto EXIT; + goto err_disable_apll22m; } regmap_update_bits(afe->regmap, AFE_APLL1_TUNER_CFG, @@ -332,7 +334,13 @@ int mt8192_apll1_enable(struct mtk_base_afe *afe) AFE_22M_ON_MASK_SFT, 0x1 << AFE_22M_ON_SFT); -EXIT: + return 0; + +err_disable_apll22m: + clk_disable_unprepare(afe_priv->clk[CLK_APLL22M]); +err_disable_mux_setting: + apll1_mux_setting(afe, false); + return ret; } @@ -358,20 +366,22 @@ int mt8192_apll2_enable(struct mtk_base_afe *afe) int ret; /* setting for APLL */ - apll2_mux_setting(afe, true); + ret = apll2_mux_setting(afe, true); + if (ret) + return ret; ret = clk_prepare_enable(afe_priv->clk[CLK_APLL24M]); if (ret) { dev_err(afe->dev, "%s clk_prepare_enable %s fail %d\n", __func__, aud_clks[CLK_APLL24M], ret); - goto EXIT; + goto err_disable_mux_setting; } ret = clk_prepare_enable(afe_priv->clk[CLK_APLL2_TUNER]); if (ret) { dev_err(afe->dev, "%s clk_prepare_enable %s fail %d\n", __func__, aud_clks[CLK_APLL2_TUNER], ret); - goto EXIT; + goto err_disable_apll24m; } regmap_update_bits(afe->regmap, AFE_APLL2_TUNER_CFG, @@ -382,7 +392,13 @@ int mt8192_apll2_enable(struct mtk_base_afe *afe) AFE_24M_ON_MASK_SFT, 0x1 << AFE_24M_ON_SFT); -EXIT: + return 0; + +err_disable_apll24m: + clk_disable_unprepare(afe_priv->clk[CLK_APLL24M]); +err_disable_mux_setting: + apll2_mux_setting(afe, false); + return ret; } -- 2.53.0