Linux I2C development
 help / color / mirror / Atom feed
* [PATCH v2 1/3] i2c: lpc2k: Add check for clk_enable()
@ 2024-11-05 16:18 Jiasheng Jiang
  2024-11-05 16:18 ` [PATCH v2 2/3] i2c: pxa: Add check for clk_enable() and clk_prepare_enable() Jiasheng Jiang
  2024-11-05 16:18 ` [PATCH v2 3/3] i2c: rk3x: Add check for clk_enable() Jiasheng Jiang
  0 siblings, 2 replies; 6+ messages in thread
From: Jiasheng Jiang @ 2024-11-05 16:18 UTC (permalink / raw)
  To: andi.shyti
  Cc: rmk, max.schwarz, dianders, david.wu, heiko, vz, wsa, manabian,
	linux-arm-kernel, linux-rockchip, linux-i2c, linux-kernel,
	Jiasheng Jiang

Add check for the return value of clk_enable() in order to catch the
potential exception.

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-lpc2k.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-08  2:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05 16:18 [PATCH v2 1/3] i2c: lpc2k: Add check for clk_enable() Jiasheng Jiang
2024-11-05 16:18 ` [PATCH v2 2/3] i2c: pxa: Add check for clk_enable() and clk_prepare_enable() Jiasheng Jiang
2024-11-05 16:18 ` [PATCH v2 3/3] i2c: rk3x: Add check for clk_enable() Jiasheng Jiang
2024-11-05 21:29   ` Doug Anderson
2024-11-06 23:01     ` Andi Shyti
2024-11-08  2:27       ` Jiasheng Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox