diff mbox series

media: ov7251: fix mutex lock unbalance

Message ID fd0d823dce99b4014713c476c750b2a76d825d3e.1652458100.git.mchehab@kernel.org
State Accepted
Commit 4d52db40c76fb2afa687feefcf765458bb2c9cae
Headers show
Series media: ov7251: fix mutex lock unbalance | expand

Commit Message

Mauro Carvalho Chehab May 13, 2022, 4:08 p.m. UTC
As reported by smatch/sparse:

	drivers/media/i2c/ov7251.c:1381 ov7251_s_stream() warn: inconsistent returns '&ov7251->lock'.
	  Locked on  : 1381
	  Unlocked on: 1377

There's a lock unbalance at this routine, as it keeps the lock on
certain errors. Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 drivers/media/i2c/ov7251.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/media/i2c/ov7251.c b/drivers/media/i2c/ov7251.c
index 4867dc86cd2e..0e7be15bc20a 100644
--- a/drivers/media/i2c/ov7251.c
+++ b/drivers/media/i2c/ov7251.c
@@ -1378,6 +1378,7 @@  static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
 
 err_power_down:
 	pm_runtime_put_noidle(ov7251->dev);
+	mutex_unlock(&ov7251->lock);
 	return ret;
 }