spi: amlogic-spisg: check clk_prepare_enable() return value

The driver ignored clk_prepare_enable() failures for sclk during
probe and for core/sclk during runtime resume. Propagate the errors
and, on resume, disable core if enabling sclk fails, so probe/resume
do not continue with clocks disabled or report success falsely.

Fixes: cef9991e04 ("spi: Add Amlogic SPISG driver")
Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
Link: https://patch.msgid.link/20260831094553.2247003-1-dayou5941@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Li Youhong 2026-08-31 17:45:53 +08:00 committed by Mark Brown
parent b34afbedb1
commit c595dcbce2
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -754,7 +754,9 @@ static int aml_spisg_clk_init(struct spisg_device *spisg, void __iomem *base)
return PTR_ERR(spisg->sclk);
}
clk_prepare_enable(spisg->sclk);
ret = clk_prepare_enable(spisg->sclk);
if (ret)
return ret;
return 0;
}
@ -901,9 +903,18 @@ static int spisg_suspend_runtime(struct device *dev)
static int spisg_resume_runtime(struct device *dev)
{
struct spisg_device *spisg = dev_get_drvdata(dev);
int ret;
ret = clk_prepare_enable(spisg->core);
if (ret)
return ret;
ret = clk_prepare_enable(spisg->sclk);
if (ret) {
clk_disable_unprepare(spisg->core);
return ret;
}
clk_prepare_enable(spisg->core);
clk_prepare_enable(spisg->sclk);
pinctrl_pm_select_default_state(&spisg->pdev->dev);
return 0;