summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Youhong <liyouhong@kylinos.cn>2026-08-28 10:54:23 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2026-09-11 15:03:03 +1000
commit8ba2b068e1b3607289ba5778e4c27c167fdbfee6 (patch)
tree78d0af28d94af76f7d42ea2fd2f3cdc5d555a4bb
parent9c53c82cefcd4668e8bed2d4029e24546aa89daf (diff)
downloadlinux-next-8ba2b068e1b3607289ba5778e4c27c167fdbfee6.tar.gz
linux-next-8ba2b068e1b3607289ba5778e4c27c167fdbfee6.zip
hwrng: imx-rngc - check clk_prepare_enable() return value
The driver ignored clk_prepare_enable() failures during probe and resume. If enabling the RNG clock fails, subsequent register accesses or resume after system sleep may not work while the driver still reports success. Signed-off-by: Li Youhong <liyouhong@kylinos.cn> Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/char/hw_random/imx-rngc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c
index 7693328f1056..0545a1870146 100644
--- a/drivers/char/hw_random/imx-rngc.c
+++ b/drivers/char/hw_random/imx-rngc.c
@@ -266,7 +266,9 @@ static int __init imx_rngc_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
- clk_prepare_enable(rngc->clk);
+ ret = clk_prepare_enable(rngc->clk);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "Cannot enable rng_clk\n");
ver_id = readl(rngc->base + RNGC_VER_ID);
rng_type = FIELD_GET(RNG_TYPE, ver_id);
@@ -338,9 +340,7 @@ static int imx_rngc_resume(struct device *dev)
{
struct imx_rngc *rngc = dev_get_drvdata(dev);
- clk_prepare_enable(rngc->clk);
-
- return 0;
+ return clk_prepare_enable(rngc->clk);
}
static const struct dev_pm_ops imx_rngc_pm_ops = {