All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
	Paul Elder <paul.elder@ideasonboard.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCH] media: i2c: thp7312: Fix missing unlock in return path
Date: Tue, 28 Nov 2023 12:22:22 +0200	[thread overview]
Message-ID: <20231128102222.9795-1-laurent.pinchart@ideasonboard.com> (raw)

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@ideasonboard.com>
---
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


             reply	other threads:[~2023-11-28 10:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 10:22 Laurent Pinchart [this message]
2023-11-28 10:24 ` [PATCH] media: i2c: thp7312: Fix missing unlock in return path Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231128102222.9795-1-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=sakari.ailus@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.