[PATCH] media: i2c: thp7312: Fix missing unlock in return path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One of the return paths in the thp7312_fw_write() function failed to
release a lock. Fix it.

Fixes: 29adc7a89b52 ("media: i2c: Add driver for THine THP7312")
Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
---
Sakari, this patch fixes a bug in your master branch scheduled for v6.8.
Feel free to apply it on top or squash it with the commit that
introduced the bug based on what is the most convenient for you.
---
 drivers/media/i2c/thp7312.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/thp7312.c b/drivers/media/i2c/thp7312.c
index 04b78c1f8090..3d46e428e0ac 100644
--- a/drivers/media/i2c/thp7312.c
+++ b/drivers/media/i2c/thp7312.c
@@ -1805,12 +1805,15 @@ static enum fw_upload_err thp7312_fw_write(struct fw_upload *fw_upload,
 	struct device *dev = thp7312->dev;
 	u16 header_size = size - THP7312_FW_RAM_SIZE;
 	enum fw_upload_err ret;
+	bool cancel;
 
 	mutex_lock(&thp7312->fw_lock);
-	if (thp7312->fw_cancel)
-		return FW_UPLOAD_ERR_CANCELED;
+	cancel = thp7312->fw_cancel;
 	mutex_unlock(&thp7312->fw_lock);
 
+	if (cancel)
+		return FW_UPLOAD_ERR_CANCELED;
+
 	ret = thp7312_flash_erase(thp7312);
 	if (ret != FW_UPLOAD_ERR_NONE)
 		return ret;

base-commit: bdfbc0f7b7d2b8e9a2ddeb2da7f003c4f60da97e
-- 
Regards,

Laurent Pinchart





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux