diff mbox series

[1/3] i2c: lpc2k: Add check for clk_enable()

Message ID 20241104214310.6048-1-jiashengjiangcool@gmail.com (mailing list archive)
State New
Headers show
Series [1/3] i2c: lpc2k: Add check for clk_enable() | expand

Commit Message

Jiasheng Jiang Nov. 4, 2024, 9:43 p.m. UTC
Add check for the return value of clk_enable() in order to catch the
potential exception.

Fixes: 3f9c37a0c9a5 ("i2c: lpc2k: add driver")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
---
 drivers/i2c/busses/i2c-lpc2k.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 9fb33cbf7419..ea9831f34cd6 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -442,8 +442,14 @@  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;
+
+	ret = clk_enable(i2c->clk);
+	if (ret) {
+		dev_err(dev, "failed to enable clock: %d\n", ret);
+		return ret;
+	}
 
-	clk_enable(i2c->clk);
 	i2c_lpc2k_reset(i2c);
 
 	return 0;