mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: hix5hd2: check clk_prepare_enable in runtime resume
@ 2026-10-26 11:26 Tang Bin
  2026-10-28 16:54 ` Andi Shyti
  0 siblings, 1 reply; 2+ messages in thread
From: Tang Bin @ 2026-10-26 11:26 UTC (permalink / raw)
  To: andi.shyti; +Cc: linux-i2c, linux-kernel, tangbin

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@cmss.chinamobile.com>
---
 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: hix5hd2: check clk_prepare_enable in runtime resume
  2026-10-26 11:26 [PATCH] i2c: hix5hd2: check clk_prepare_enable in runtime resume Tang Bin
@ 2026-10-28 16:54 ` Andi Shyti
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Shyti @ 2026-10-28 16:54 UTC (permalink / raw)
  To: Tang Bin; +Cc: linux-i2c, linux-kernel

Hi Tang,

On Mon, Oct 26, 2026 at 07:26:08PM +0800, Tang Bin wrote:
> 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@cmss.chinamobile.com>

pushed to i2c/i2c.

Please next time send these patches in a single series.

BTW, for both I removed the Fixes tag as I don't think they are
necessary.

Andi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-28 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 11:26 [PATCH] i2c: hix5hd2: check clk_prepare_enable in runtime resume Tang Bin
2026-10-28 16:54 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®