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=1795040340; b=Cw/02jp2GMmE6wVcN2GaK4xsZIUpX4ezhM1wn3ZCeQ7c9nhE/f4KN+rDk/ImX0gt76TM wSNd/q9AK6TMcAuInhpVJmhUKgT/Q8d/ZI7iWFOQ6QB87cVjC4uj+S1ib5mEeLCVa3cKs HJHhTdjbX3kt69tCjv+VBfYFQRL0ylUgyerK3B8oZyVB9DQDAEkCobdGzlonpyKFFANfy JwS/CrcrTqQ3Gv7QAw8Xscmo7nmsBwk3uY1iBEyP4IbX+zn/c1SRQ/nEDtT17k1qu/qPs Yi4h3x6bbZSaARfo/dQmkvuOBfNZzU3f/9Nc494cRZEmwEgKhka4lqBd4p8usvJWKAw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795040340; 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=/6qJSyZ36V28WX3xcRQghUB0uY279/3XG4ps6bALo2g=; b=3rbDGDuk6R+KZXVj+69PwPGvWYB6WActdR5BYB8MA+J9w5kVFDyTsTEqyvTI9f3hHOMN TdHdxk8dwKE44sSN5gf9AEBHEg/2VcUCUz9DjeGO4ruLd0R7alfjdDGWqT+/WvDcyd7YZ bW21jc2Bz9b5cllZR7JTqIv6SlErIdifUD3HW6CIPY8EX6zEw6accjUMSV3N10+Mh2ufJ b9NRkYfhfDiDVfVaz/zF31OhzvNxPhGo5tczQroJDf5JouxWDLbfdC+2puKPOs2Q3FngK 38l3TtxXUZ94TGARRY33djAjPWyuinLzPQs4XQEel1P+KiC9rzFzWc6LYG/7IlIfvqw== 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=Uzzbsg3A; 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 CBEA4606A337; Wed, 18 Nov 2026 22:19:00 +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=Uzzbsg3A Received: by smtp.kernel.org (Postfix) with ESMTPSA id F375C1F000C5; Wed, 18 Nov 2026 22:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795040340; bh=/6qJSyZ36V28WX3xcRQghUB0uY279/3XG4ps6bALo2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Uzzbsg3AxntL+S5MSUoamcl6qOTS8hHYQT8v78+L8a1xr2HWREN+xZdhNwdE9pro0 ecRyiwSEA3mwabFibawNtkcRmdKaDs5eXOcU+pmHaf3QM8IMqTe3tKE9O03N/hDd7h gozTKaEufOEnJ6armRsuWdu5iPLj+6+M9TXjsmDE= 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.6 2422/3318] ASoC: mediatek: mt8192: fix error handling in APLL enable functions Date: Wed, 18 Nov 2026 15:50:44 +0100 Message-ID: <20261118150434.132374715@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150313.527275416@linuxfoundation.org> References: <20261118150313.527275416@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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