[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241107211428.32273-2-jiashengjiangcool@gmail.com>
Date: Thu, 7 Nov 2024 21:14:27 +0000
From: Jiasheng Jiang <jiashengjiangcool@...il.com>
To: andi.shyti@...nel.org
Cc: dianders@...omium.org,
rmk@...-67.arm.linux.org.uk,
max.schwarz@...ine.de,
david.wu@...k-chips.com,
heiko@...ech.de,
vz@...ia.com,
wsa@...nel.org,
manabian@...il.com,
linux-arm-kernel@...ts.infradead.org,
linux-rockchip@...ts.infradead.org,
linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiashengjiangcool@...il.com>
Subject: [PATCH v3 2/3] i2c: pxa: Add check for clk_enable() and clk_prepare_enable()
Add check for the return values of clk_enable() and clk_prepare_enable()
in order to catch the potential exceptions.
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
Changelog:
v2 -> v3:
1. Roll back unsuitable dev_err_probe() to dev_err()
2. Correct the usage of dev_err_probe()
v1 -> v2:
1. Remove the Fixes tag.
2. Use dev_err_probe to simplify error handling.
---
drivers/i2c/busses/i2c-pxa.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 4d76e71cdd4b..4a92c5386df6 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1503,7 +1503,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
i2c->adap.name);
}
- clk_prepare_enable(i2c->clk);
+ ret = clk_prepare_enable(i2c->clk);
+ if (ret)
+ return dev_err_probe(&dev->dev, ret, "failed to enable clock\n");
if (i2c->use_pio) {
i2c->adap.algo = &i2c_pxa_pio_algorithm;
@@ -1560,8 +1562,14 @@ static int i2c_pxa_suspend_noirq(struct device *dev)
static int i2c_pxa_resume_noirq(struct device *dev)
{
struct pxa_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_pxa_reset(i2c);
return 0;
--
2.25.1
Powered by blists - more mailing lists