memory: exynos5422-dmc: handle clock enable failures
Subsystems (4)
PATCH v2 1/1 memory: exynos5422-dmc: handle clock enable failures
Check the return values of clk_prepare_enable() for fout_bpll and mout_bpll.
If enabling fout_bpll fails, propagate the error. If enabling mout_bpll fails, disable fout_bpll before returning. This keeps the clock enable count balanced on probe error paths.
---
Changes in v2:
- Use the full author name in From and Signed-off-by.
- Add Fixes and Cc stable tags.
- Generate the submission with git format-patch.
drivers/memory/samsung/exynos5422-dmc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/memory/samsung/exynos5422-dmc.c +9 -2
@@ -1297,8 +1297,15 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc)if (ret)return ret; -clk_prepare_enable (dmc->fout_bpll); -clk_prepare_enable (dmc->mout_bpll); + ret =clk_prepare_enable (dmc->fout_bpll); +if (ret) +return ret; + + ret =clk_prepare_enable (dmc->mout_bpll); +if (ret) { +clk_disable_unprepare (dmc->fout_bpll); +return ret; + }/* * Some bootloaders do not set clock routes correctly.
Signature · 1 line
2.34.1
Quoted 31 lines · Jiawen Liu
Check the return values of
clk_prepare_enable()forfout_bpllandmout_bpll.If enabling
fout_bpllfails, propagate the error. If enablingmout_bpllfails, disablefout_bpllbefore returning. This keeps the clock enable count balanced on probe error paths.Fixes 6e7674c3c6df ("memory: Add DMC driver for Exynos5422")Signed-off-by Jiawen Liu <[email protected]>---
Changes in v2:
- Use the full author name in From and Signed-off-by.
- Add Fixes and Cc stable tags.
- Generate the submission with git format-patch.drivers/memory/samsung/exynos5422-dmc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)drivers/memory/samsung/exynos5422-dmc.c +2
-2@@ -1297,8 +1297,15 @@ static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc)if (ret)return ret; -clk_prepare_enable (dmc->fout_bpll); -clk_prepare_enable (dmc->mout_bpll); + ret =clk_prepare_enable (dmc->fout_bpll); +if (ret)
drivers/memory/samsung/exynos5422-dmc.c static int exynos5_dmc_init_clks(struct exynos5_dmc *dmc) · line 1311
Quoted 10 lines
drivers/memory/samsung/exynos5422-dmc.c +7
-0+return ret; + + ret =clk_prepare_enable (dmc->mout_bpll); +if (ret) { +clk_disable_unprepare (dmc->fout_bpll); +return ret; + }/* * Some bootloaders do not set clock routes correctly.
This one looks good.
Quoted 8 lines · Jiawen Liu
Check the return values of
clk_prepare_enable()forfout_bpllandmout_bpll.If enabling
fout_bpllfails, propagate the error. If enablingmout_bpllfails, disablefout_bpllbefore returning. This keeps the clock enable count balanced on probe error paths.[...]
Applied, thanks!
[1/1] memory: exynos5422-dmc: handle clock enable failures
https://git.kernel.org/krzk/linux-mem-ctrl/c/cce46902ea9fcd585cd200fffa3166f63bc571f1
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>