From: Jiasheng Jiang <jiashengjiangcool@gmail.com>
To: andi.shyti@kernel.org
Cc: rmk@dyn-67.arm.linux.org.uk, max.schwarz@online.de,
dianders@chromium.org, david.wu@rock-chips.com, heiko@sntech.de,
vz@mleia.com, wsa@kernel.org, manabian@gmail.com,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jiasheng Jiang <jiashengjiangcool@gmail.com>
Subject: [PATCH v2 2/3] i2c: pxa: Add check for clk_enable() and clk_prepare_enable()
Date: Tue, 5 Nov 2024 16:18:19 +0000 [thread overview]
Message-ID: <20241105161820.32512-2-jiashengjiangcool@gmail.com> (raw)
In-Reply-To: <20241105161820.32512-1-jiashengjiangcool@gmail.com>
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@gmail.com>
---
Changelog:
v1 -> v2:
1. Remove the Fixes tag.
2. Use dev_err_probe to simplify error handling.
---
drivers/i2c/busses/i2c-pxa.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 4d76e71cdd4b..0ee6fe83de40 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: %d\n", ret);
if (i2c->use_pio) {
i2c->adap.algo = &i2c_pxa_pio_algorithm;
@@ -1560,8 +1562,12 @@ 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)
+ return dev_err_probe(dev, ret, "failed to enable clock: %d\n", ret);
- clk_enable(i2c->clk);
i2c_pxa_reset(i2c);
return 0;
--
2.25.1
next prev parent reply other threads:[~2024-11-05 16:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 16:18 [PATCH v2 1/3] i2c: lpc2k: Add check for clk_enable() Jiasheng Jiang
2024-11-05 16:18 ` Jiasheng Jiang [this message]
2024-11-05 16:18 ` [PATCH v2 3/3] i2c: rk3x: " Jiasheng Jiang
2024-11-05 21:29 ` Doug Anderson
2024-11-06 23:01 ` Andi Shyti
2024-11-08 2:27 ` Jiasheng Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241105161820.32512-2-jiashengjiangcool@gmail.com \
--to=jiashengjiangcool@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=david.wu@rock-chips.com \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=manabian@gmail.com \
--cc=max.schwarz@online.de \
--cc=rmk@dyn-67.arm.linux.org.uk \
--cc=vz@mleia.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox