[PATCH] i2c: hix5hd2: check clk_prepare_enable in runtime resume

From: Tang Bin

Date: Mon Oct 26 2026 - 07:47:37 EST


hix5hd2_i2c_runtime_resume() ignored the return value of
clk_prepare_enable(priv->clk), then ran hix5hd2_i2c_init() (register
access) and returned 0. On clock enable failure the hardware is accessed
with the clock disabled (bus hang) and the matching runtime_suspend()
clk_disable_unprepare() unbalances the clock count. Propagate the error.

Fixes: 9242e72aaea0 ("i2c: use dev_get_drvdata() to get private data in suspend/resume hooks")
Signed-off-by: Tang Bin <tangbin@xxxxxxxxxxxxxxxxxxxx>
---
drivers/i2c/busses/i2c-hix5hd2.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c
index 95ab910b8..90d38c478 100644
--- a/drivers/i2c/busses/i2c-hix5hd2.c
+++ b/drivers/i2c/busses/i2c-hix5hd2.c
@@ -486,8 +486,12 @@ static int hix5hd2_i2c_runtime_suspend(struct device *dev)
static int hix5hd2_i2c_runtime_resume(struct device *dev)
{
struct hix5hd2_i2c_priv *priv = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_prepare_enable(priv->clk);
+ if (ret)
+ return ret;

- clk_prepare_enable(priv->clk);
hix5hd2_i2c_init(priv);

return 0;
--
2.52.0.windows.1