Skip to contentSkip to conversation

i2c: lpc2k: Add check for clk_enable()

PATCH Applied Chenyuan Yang 2 participants 2 messages Apr 12, 2025 – Apr 13, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: lpc2k: Add check for clk_enable()

Add check for the return value of clk_enable() to catch the potential error.

This is similar to the commit 8332e6670997
("spi: zynq-qspi: Add check for clk_enable()").

Fixes 3f9c37a0c9a5 ("i2c: lpc2k: add driver")
---
 drivers/i2c/busses/i2c-lpc2k.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-lpc2k.c +6 -1
index 6943a0de860a..ccd13c4fb83e 100644
@@ -442,8 +442,13 @@ static int i2c_lpc2k_suspend(struct device *dev)
 static int i2c_lpc2k_resume(struct device *dev)
 {
 	struct lpc2k_i2c *i2c = dev_get_drvdata(dev);
+	int ret;
 
-	clk_enable(i2c->clk);
+	ret = clk_enable(i2c->clk);
+	if (ret) {
+		dev_err(dev, "failed to enable clock.\n");
+		return ret;
+	}
 	i2c_lpc2k_reset(i2c);
 
 	return 0;
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw

Hi Chenyuan,

Quoted 8 lines · Chenyuan Yang

Add check for the return value of clk_enable() to catch the potential error.

This is similar to the commit 8332e6670997
("spi: zynq-qspi: Add check for clk_enable()").

Fixes 3f9c37a0c9a5 ("i2c: lpc2k: add driver")

I removed the Fixes tag, I think it's a bit of an overkill.

Merged into i2c/i2c-host.

Thanks,
Andi