summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChenyuan Yang <chenyuan0y@gmail.com>2025-04-12 22:37:13 +0300
committerAndi Shyti <andi@smida.it>2025-05-19 23:23:54 +0300
commitb7a886e7e9e814e9fb30ec85935c098bf7f3d78d (patch)
treea87cec8844604fca583f2b2dddb42ee065f99097
parent5a1934f1c23feb525facdfa643600124a611c974 (diff)
downloadlinux-b7a886e7e9e814e9fb30ec85935c098bf7f3d78d.tar.xz
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()"). Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com> Link: https://lore.kernel.org/r/20250412193713.105838-1-chenyuan0y@gmail.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
-rw-r--r--drivers/i2c/busses/i2c-lpc2k.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c
index 6943a0de860a..ccd13c4fb83e 100644
--- a/drivers/i2c/busses/i2c-lpc2k.c
+++ b/drivers/i2c/busses/i2c-lpc2k.c
@@ -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;