From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, "Krzysztof Kozlowski" <krzk@kernel.org>,
"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
"Chanwoo Choi" <cw00.choi@samsung.com>,
"Peter Griffin" <peter.griffin@linaro.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Brian Masney" <bmasney+clk@redhat.com>,
"Jerome Brunet" <jbrunet+clk@baylibre.com>,
"Dávid Virág" <virag.david003@gmail.com>,
"Sam Protsenko" <semen.protsenko@linaro.org>,
linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 02/12] clk: samsung: exynos-arm64: Do not store ERR_PTR in data->clk
Date: Fri, 27 Nov 2026 18:03:10 +0000 [thread overview]
Message-ID: <20261127180416.3277544-3-lee@kernel.org> (raw)
In-Reply-To: <20261127180416.3277544-1-lee@kernel.org>
exynos_arm64_enable_bus_clk() assigns parent_clk to data->clk before
checking IS_ERR(parent_clk) or enabling the clock. Because
exynos_arm64_register_cmu_pm() logs the failure and continues
registering PM callbacks, exynos_arm64_cmu_suspend() and
exynos_arm64_cmu_resume() later pass the error pointer to
clk_disable_unprepare() and clk_prepare_enable(), causing a crash.
Only store parent_clk in data->clk after IS_ERR() and
clk_prepare_enable() succeed, and release the clock reference on enable
failure.
Fixes: f05dc2024316 ("clk: samsung: exynos5433: Extract PM support to common ARM64 layer")
Closes: https://sashiko.dev/#/bug/linux-d237d28a-7387-4379-9bf4-331a7052082c
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/clk/samsung/clk-exynos-arm64.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsung/clk-exynos-arm64.c
index 35d4de233cc1..360bd5d8421d 100644
--- a/drivers/clk/samsung/clk-exynos-arm64.c
+++ b/drivers/clk/samsung/clk-exynos-arm64.c
@@ -149,25 +149,33 @@ static int __init exynos_arm64_enable_bus_clk(struct device *dev,
struct device_node *np, const struct samsung_cmu_info *cmu)
{
struct clk *parent_clk;
+ int ret;
if (!cmu->clk_name)
return 0;
- if (dev) {
- struct exynos_arm64_cmu_data *data;
-
+ if (dev)
parent_clk = clk_get(dev, cmu->clk_name);
- data = dev_get_drvdata(dev);
- if (data)
- data->clk = parent_clk;
- } else {
+ else
parent_clk = of_clk_get_by_name(np, cmu->clk_name);
- }
if (IS_ERR(parent_clk))
return PTR_ERR(parent_clk);
- return clk_prepare_enable(parent_clk);
+ ret = clk_prepare_enable(parent_clk);
+ if (ret) {
+ clk_put(parent_clk);
+ return ret;
+ }
+
+ if (dev) {
+ struct exynos_arm64_cmu_data *data = dev_get_drvdata(dev);
+
+ if (data)
+ data->clk = parent_clk;
+ }
+
+ return 0;
}
static int __init exynos_arm64_cmu_prepare_pm(struct device *dev,
--
2.56.1.839.g22a8290db9-goog
next prev parent reply other threads:[~2026-11-27 18:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 18:03 [PATCH 00/12] clk: samsung: Fix power-domain, bus clock, and missing PLL sentinel bugs Lee Jones
2026-11-27 18:03 ` [PATCH 01/12] clk: samsung: exynos5-subcmu: Detach power domain on add failure Lee Jones
2026-11-27 18:03 ` Lee Jones [this message]
2026-11-27 18:03 ` [PATCH 03/12] clk: samsung: artpec8: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` [PATCH 04/12] clk: samsung: artpec9: Terminate PLL rate tables with sentinels Lee Jones
2026-11-27 18:03 ` [PATCH 05/12] clk: samsung: exynos5250: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` [PATCH 06/12] clk: samsung: exynos5260: Terminate PLL rate tables with sentinels Lee Jones
2026-11-27 18:03 ` [PATCH 07/12] clk: samsung: exynos5410: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` [PATCH 08/12] clk: samsung: exynos7885: " Lee Jones
2026-11-27 18:03 ` [PATCH 09/12] clk: samsung: exynos850: " Lee Jones
2026-11-27 18:03 ` [PATCH 10/12] clk: samsung: exynos8895: Terminate PLL rate tables with sentinels Lee Jones
2026-11-27 18:03 ` [PATCH 11/12] clk: samsung: exynosautov920: Terminate PLL rate table with sentinel Lee Jones
2026-11-27 18:03 ` [PATCH 12/12] clk: samsung: fsd: Terminate PLL rate tables with sentinels Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127180416.3277544-3-lee@kernel.org \
--to=lee@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=bmasney+clk@redhat.com \
--cc=cw00.choi@samsung.com \
--cc=jbrunet+clk@baylibre.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=stable@vger.kernel.org \
--cc=virag.david003@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®