diff mbox series

i2c: pxa: fix call balance of i2c->clk handling routines

Message ID 20250211145321.1137001-1-mordan@ispras.ru
State New
Headers show
Series i2c: pxa: fix call balance of i2c->clk handling routines | expand

Commit Message

Vitalii Mordan Feb. 11, 2025, 2:53 p.m. UTC
If the clock i2c->clk was not enabled in i2c_pxa_probe(), it should not be
disabled in any path.

Found by Linux Verification Center (linuxtesting.org) with Klever.

Fixes: c3cef3f3c07b ("[ARM] pxa: update pxa i2c driver to use clk support")
Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
---
 drivers/i2c/busses/i2c-pxa.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index cb6988482673..4144b0ae195e 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1503,7 +1503,11 @@  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) {
+		dev_err(&dev->dev, "failed to enable clock\n");
+		return ret;
+	}
 
 	if (i2c->use_pio) {
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;