clk: samsung: exynos-arm64: Propagate CMU resume clock errors
Subsystems (3)
PATCH 1/1 clk: samsung: exynos-arm64: Propagate CMU resume clock errors
When runtime PM resumes a suspended Exynos5433 audio CMU, enabling fout_aud_pll can return -ETIMEDOUT if the PLL fails to lock. The resume callback ignores the error and can restore registers without the required clock. It then reports success to runtime PM, allowing a later suspend to release a clock reference that resume never acquired.
Return the error from clk_prepare_enable() before enabling temporary parent clocks or restoring registers. The clock framework rolls back preparation if enable fails. On success, the callback keeps its clock reference until suspend.
Verification included static
review of the clock and PM paths, ARM64 builds of the Exynos clock objects with and without CONFIG_PM_SLEEP, and the kernel patch style check. Runtime and hardware reproduction were not performed.
--- drivers/clk/samsung/clk-exynos-arm64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/samsung/clk-exynos-arm64.c +4 -2
@@ -359,9 +359,11 @@ int exynos_arm64_cmu_suspend(struct device *dev)int exynos_arm64_cmu_resume (struct device *dev) {struct exynos_arm64_cmu_data *data =dev_get_drvdata (dev); -int i; +int i, ret; -clk_prepare_enable (data->clk); + ret =clk_prepare_enable (data->clk); +if (ret) +return ret;for (i =0 ; i < data->nr_pclks; i++)clk_prepare_enable (data->pclks[i]);
Signature · 1 line
2.34.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] clk: samsung: ERR_PTR dereference in…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] clk: samsung: ERR_PTR dereference in exynos_arm64_cmu_resume()
[1]
--
commit e3d194f1b1626249b01718daea54f9d69a2fb097
Author: Jiawen Liu <[email protected]>
clk: samsung: exynos-arm64: Propagate CMU resume clock errors
This commit checks and propagates the return value of clk_prepare_enable() on data->clk in exynos_arm64_cmu_resume() instead of ignoring errors.
Quoted 5 lines
drivers/clk/samsung/clk-exynos-arm64.c +0
-0
drivers/clk/samsung/clk-exynos-arm64.c int exynos_arm64_cmu_suspend(struct device *dev) · line 366
Quoted 10 lines
drivers/clk/samsung/clk-exynos-arm64.c +4
-2@@ -359,9 +359,11 @@ int exynos_arm64_cmu_suspend(struct device *dev)int exynos_arm64_cmu_resume (struct device *dev) {struct exynos_arm64_cmu_data *data =dev_get_drvdata (dev); -int i; +int i, ret; -clk_prepare_enable (data->clk); + ret =clk_prepare_enable (data->clk); +if (ret) +return ret;
[Severity: High]
This problem wasn't introduced by this patch, but can clk_prepare_enable() dereference an ERR_PTR in data->clk [1]?
In exynos_arm64_enable_bus_clk(), clk_get() is stored into data->clk before checking IS_ERR(parent_clk):
drivers/clk/samsung/clk-exynos-arm64.c:exynos_arm64_enable_bus_clk() {
if (dev) {
struct exynos_arm64_cmu_data *data;
parent_clk = clk_get(dev, cmu->clk_name);
data = dev_get_drvdata(dev);
if (data)
data->clk = parent_clk;
}
}If clk_get() fails, exynos_arm64_register_cmu_pm() logs a warning and continues registering PM, so a subsequent resume passes the ERR_PTR to clk_prepare_enable() and crashes.
[1] https://sashiko.dev/#/bug/linux-d237d28a-7387-4379-9bf4-331a7052082c
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Krzysztof Kozlowski
maintainerQuoted 11 lines · Jiawen Liu
When runtime PM resumes a suspended Exynos5433 audio CMU, enabling
fout_aud_pllcan return-ETIMEDOUTif the PLL fails to lock. The resume callback ignores the error and can restore registers without the required clock. It then reports success to runtime PM, allowing a later suspend to release a clock reference that resume never acquired.Return the error from
clk_prepare_enable()before enabling temporary parent clocks or restoring registers. The clock framework rolls back preparation if enable fails. On success, the callback keeps its clock reference until suspend.
Quoted 4 lines
Verification included static
review of the clock and PM paths, ARM64 builds of the Exynos clock objects with and withoutCONFIG_PM_SLEEP, and the kernel patch style check. Runtime and hardware reproduction were not performed.
Unfortunately "kernel patch style check" is not a step of verification whether code is correct or not. Do not use LLM to write commit msgs, they are pretty pointless.
Best regards,
Krzysztof
Krzysztof Kozlowski
maintainerQuoted 16 lines · Jiawen Liu
When runtime PM resumes a suspended Exynos5433 audio CMU, enabling
fout_aud_pllcan return-ETIMEDOUTif the PLL fails to lock. The resume callback ignores the error and can restore registers without the required clock. It then reports success to runtime PM, allowing a later suspend to release a clock reference that resume never acquired.Return the error from
clk_prepare_enable()before enabling temporary parent clocks or restoring registers. The clock framework rolls back preparation if enable fails. On success, the callback keeps its clock reference until suspend.Verification included static
review of the clock and PM paths, ARM64 builds of the Exynos clock objects with and withoutCONFIG_PM_SLEEP, and the kernel patch style check. Runtime and hardware reproduction were not performed.
Quoted 6 lines
Fixes 523d3de41f02 ("clk: samsung: exynos5433: Add support for runtime PM")Signed-off-by Jiawen Liu <[email protected]>--- drivers/clk/samsung/clk-exynos-arm64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
You sent multiple independent patches, to multiple independent subsystems. The amount of these patches clearly suggest this was AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing relevant patches into patchsets. This makes reviewing difficult and might cause multiple reviewers to address the same issue. Replying to the entire set is impossible and requires handling each patch independently, instead of applying or discarding the set. Maintainers also won't see the bigger picture of your work. Quite worrying.
Please read kernel documentation BEFORE posting more work. It will explain you how to identify subsystems, how to organize your work per subsystem (so a patchset grouping multiple patches with a short cover letter), how to document the issue discovery method and what was or was not tested.
Best regards,
Krzysztof