diff mbox series

[3/3] media: i2c: ov9282: Add missing clk_disable_unprepare to error path

Message ID 20221128162249.536455-4-dave.stevenson@raspberrypi.com
State Accepted
Commit b2ea130c2541a8439fd9a288f319cb257ee8e9a0
Headers show
Series ov9282: Fix Smatch errors | expand

Commit Message

Dave Stevenson Nov. 28, 2022, 4:22 p.m. UTC
If ov9282_power_on failed the I2C write, it returned without releasing
clocks or regulators. Fix this.

Fixes: 6f7def3d8a65 ("media: i2c: ov9282: Add selection for CSI2 clock mode")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/media/i2c/ov9282.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
index 94e18da55a05..38b8d33799d5 100644
--- a/drivers/media/i2c/ov9282.c
+++ b/drivers/media/i2c/ov9282.c
@@ -1253,11 +1253,13 @@  static int ov9282_power_on(struct device *dev)
 					OV9282_GATED_CLOCK : 0);
 	if (ret) {
 		dev_err(ov9282->dev, "fail to write MIPI_CTRL00");
-		return ret;
+		goto error_clk;
 	}
 
 	return 0;
 
+error_clk:
+	clk_disable_unprepare(ov9282->inclk);
 error_reset:
 	gpiod_set_value_cansleep(ov9282->reset_gpio, 0);